Changeset 53bb8f1


Ignore:
Timestamp:
Mar 12, 2019, 3:00:54 PM (7 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
30e32b2, a2545593
Parents:
9d9a451 (diff), 91d6584 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge second draft of Aaron's thesis

Files:
15 added
1 deleted
107 edited
16 moved

Legend:

Unmodified
Added
Removed
  • .gitignore

    r9d9a451 r53bb8f1  
    1010config.py
    1111stamp-h1
     12libtool
    1213/Makefile
    1314**/Makefile
     
    4950libcfa/arm-nolib/
    5051
    51 
    5252# generated by bison and lex from parser.yy and lex.ll
    5353src/Parser/parser.output
  • Makefile.am

    r9d9a451 r53bb8f1  
    1111## Created On       : Sun May 31 22:14:18 2015
    1212## Last Modified By : Peter A. Buhr
    13 ## Last Modified On : Wed Dec 14 14:20:48 2016
    14 ## Update Count     : 15
     13## Last Modified On : Sat Feb  2 16:54:42 2019
     14## Update Count     : 21
    1515###############################################################################
    1616
     
    1818ACLOCAL_AMFLAGS  = -I automake
    1919
    20 MAINTAINERCLEANFILES = lib/* bin/* tests/.deps/* tests/.out/*
    21  # order important
     20MAINTAINERCLEANFILES = lib/* bin/* tests/.deps/* tests/.out/* # order important
    2221
    2322SUBDIRS = driver src . @LIBCFA_TARGET_DIRS@
  • Makefile.in

    r9d9a451 r53bb8f1  
    250250distcleancheck_listfiles = find . -type f -print
    251251ACLOCAL = @ACLOCAL@
    252 ALLOCA = @ALLOCA@
    253252AMTAR = @AMTAR@
    254253AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
     
    396395AUTOMAKE_OPTIONS = foreign    # do not require all the GNU file names
    397396ACLOCAL_AMFLAGS = -I automake
    398 MAINTAINERCLEANFILES = lib/* bin/* tests/.deps/* tests/.out/*
     397MAINTAINERCLEANFILES = lib/* bin/* tests/.deps/* tests/.out/* # order important
    399398SUBDIRS = driver src . @LIBCFA_TARGET_DIRS@
    400399noinst_DATA = @LIBCFA_TARGET_MAKEFILES@
     
    928927.PRECIOUS: Makefile
    929928
    930  # order important
    931929
    932930@LIBCFA_TARGET_MAKEFILES@ : Makefile $(srcdir)/libcfa/configure
  • automake/cfa.m4

    r9d9a451 r53bb8f1  
    8080        esac
    8181])
     82
     83# http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=blob_plain;f=m4/ax_check_compile_flag.m4
     84AC_DEFUN([M4CFA_CHECK_COMPILE_FLAG],
     85[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF
     86AS_VAR_PUSHDEF([CACHEVAR],[m4cfa_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl
     87AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [
     88        m4cfa_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS
     89        _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1"
     90        AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])],
     91                [AS_VAR_SET(CACHEVAR,[yes])],
     92                [AS_VAR_SET(CACHEVAR,[no])])
     93        _AC_LANG_PREFIX[]FLAGS=$m4cfa_check_save_flags])
     94AS_VAR_IF(CACHEVAR,yes,
     95        [m4_default([$2], :)],
     96        [m4_default([$3], :)])
     97AS_VAR_POPDEF([CACHEVAR])dnl
     98])dnl M4CFA_CHECK_COMPILE_FLAGS
  • benchmark/Makefile.am

    r9d9a451 r53bb8f1  
    2121include $(top_srcdir)/src/cfa.make
    2222
    23 UPPCC = u++
    24 
    2523AM_CFLAGS = -O2 -Wall -I$(srcdir) -lrt -pthread
    2624AM_CFAFLAGS = -quiet -in-tree -nodebug
    2725AM_UPPFLAGS = -quiet -nodebug -multi
    2826
    29 TOOLSDIR = ${abs_top_srcdir}/tools/
    30 REPEAT   = ${TOOLSDIR}repeat
    31 STATS    = ${TOOLSDIR}stat.py
     27BENCH_V_CC = $(__bench_v_CC_$(__quiet))
     28BENCH_V_CFA = $(__bench_v_CFA_$(__quiet))
     29BENCH_V_CXX = $(__bench_v_CXX_$(__quiet))
     30BENCH_V_GOC = $(__bench_v_GOC_$(__quiet))
     31BENCH_V_JAVAC = $(__bench_v_JAVAC_$(__quiet))
     32BENCH_V_UPP = $(__bench_v_UPP_$(__quiet))
     33
     34__quiet = verbose
     35__bench_v_CC_quiet = @
     36__bench_v_CFA_quiet = @
     37__bench_v_CXX_quiet = @
     38__bench_v_GOC_quiet = @
     39__bench_v_JAVAC_quiet = @
     40__bench_v_UPP_quiet = @
     41__bench_v_CC_verbose = $(AM_V_CC)
     42__bench_v_CFA_verbose = $(AM_V_CFA)
     43__bench_v_CXX_verbose = $(AM_V_CXX)
     44__bench_v_GOC_verbose = $(AM_V_GOC)
     45__bench_v_JAVAC_verbose = $(AM_V_JAVAC)
     46__bench_v_UPP_verbose = $(AM_V_UPP)
     47
     48
     49
     50TOOLSDIR = ${abs_top_builddir}/tools/
     51REPEAT   = ${abs_top_builddir}/tools/repeat
     52STATS    = ${abs_top_srcdir}/tools/stat.py
    3253repeats  = 30
    3354skipcompile = no
     
    3556PRINT_FORMAT = %20s: #Comments needed for spacing
    3657
    37 #prevent any tests in parallel
     58# Dummy hack tricks
     59EXTRA_PROGRAMS = dummy # build but do not install
     60dummy_SOURCES = dummyC.c dummyCXX.cpp
     61
     62dummyC.c:
     63        @echo "int main() { return 0; }" > ${@}
     64
     65dummyCXX.cpp:
     66        @echo "int main() { return 0; }" > ${@}
     67
    3868.NOTPARALLEL:
    39 
    40 #make sure automake includes the compile rules for C and C++
    41 EXTRA_PROGRAMS = dummy
    42 dummy_SOURCES = c.c cxx.cpp
    4369
    4470## =========================================================================================================
     
    5581
    5682%.runquiet :
    57         @+make $(basename $@) CFLAGS="-w"
     83        @+make $(basename $@) CFLAGS="-w" __quiet=quiet
    5884        @taskset -c 1 ./a.out
    5985        @rm -f a.out
     
    6490
    6591${REPEAT} :
    66         @+make -C ${TOOLSDIR} repeat
     92        @+make -C ${abs_top_builddir}/tools repeat
    6793
    6894## =========================================================================================================
     
    105131## =========================================================================================================
    106132loop$(EXEEXT):
    107         $(AM_V_CC)$(COMPILE) -DBENCH_N=5000000000 $(srcdir)/loop.c
     133        $(BENCH_V_CC)$(COMPILE) -DBENCH_N=5000000000 $(srcdir)/loop.c
    108134
    109135function$(EXEEXT):
    110         $(AM_V_CC)$(COMPILE) -DBENCH_N=5000000000 $(srcdir)/function.c
     136        $(BENCH_V_CC)$(COMPILE) -DBENCH_N=5000000000 $(srcdir)/function.c
    111137
    112138fetch_add$(EXEEXT):
    113         $(AM_V_CC)$(COMPILE) -DBENCH_N=500000000  $(srcdir)/fetch_add.c
     139        $(BENCH_V_CC)$(COMPILE) -DBENCH_N=500000000  $(srcdir)/fetch_add.c
    114140
    115141## =========================================================================================================
     
    134160
    135161ctxswitch-kos_fibre$(EXEEXT):
    136         $(AM_V_CXX)$(CXXCOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/kos_fibre.cpp  -I$(LIBFIBRE_DIR) -lfibre
     162        $(BENCH_V_CXX)$(CXXCOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/kos_fibre.cpp  -I$(LIBFIBRE_DIR) -lfibre
    137163
    138164ctxswitch-kos_fibre2$(EXEEXT):
    139         $(AM_V_CXX)$(CXXCOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/kos_fibre2.cpp -I$(LIBFIBRE_DIR) -lfibre
     165        $(BENCH_V_CXX)$(CXXCOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/kos_fibre2.cpp -I$(LIBFIBRE_DIR) -lfibre
    140166endif
    141167
     
    143169
    144170ctxswitch-pthread$(EXEEXT):
    145         $(AM_V_CC)$(COMPILE)    -DBENCH_N=50000000 $(srcdir)/ctxswitch/pthreads.c
     171        $(BENCH_V_CC)$(COMPILE)    -DBENCH_N=50000000 $(srcdir)/ctxswitch/pthreads.c
    146172
    147173ctxswitch-cfa_coroutine$(EXEEXT):
    148         $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/cfa_cor.c
     174        $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/cfa_cor.cfa
    149175
    150176ctxswitch-cfa_thread$(EXEEXT):
    151         $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/cfa_thrd.c
     177        $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/cfa_thrd.cfa
    152178
    153179ctxswitch-cfa_thread2$(EXEEXT):
    154         $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/cfa_thrd2.c
     180        $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/cfa_thrd2.cfa
    155181
    156182ctxswitch-upp_coroutine$(EXEEXT):
    157         $(AM_V_UPP)$(UPPCOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/upp_cor.cc
     183        $(BENCH_V_UPP)$(UPPCOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/upp_cor.cc
    158184
    159185ctxswitch-upp_thread$(EXEEXT):
    160         $(AM_V_UPP)$(UPPCOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/upp_thrd.cc
     186        $(BENCH_V_UPP)$(UPPCOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/upp_thrd.cc
    161187
    162188ctxswitch-goroutine$(EXEEXT):
    163         $(AM_V_GOC)go build -o a.out $(srcdir)/ctxswitch/goroutine.go
     189        $(BENCH_V_GOC)go build -o a.out $(srcdir)/ctxswitch/goroutine.go
    164190
    165191ctxswitch-java_thread$(EXEEXT):
    166         $(AM_V_JAVAC)javac -d $(builddir) $(srcdir)/ctxswitch/JavaThread.java
     192        $(BENCH_V_JAVAC)javac -d $(builddir) $(srcdir)/ctxswitch/JavaThread.java
    167193        @echo "#!/bin/sh" > a.out
    168194        @echo "java JavaThread" >> a.out
     
    182208
    183209mutex-pthread_lock$(EXEEXT):
    184         $(AM_V_CC)$(COMPILE)    -DBENCH_N=50000000 $(srcdir)/mutex/pthreads.c
     210        $(BENCH_V_CC)$(COMPILE)    -DBENCH_N=50000000 $(srcdir)/mutex/pthreads.c
    185211
    186212mutex-upp$(EXEEXT):
    187         $(AM_V_UPP)$(UPPCOMPILE) -DBENCH_N=50000000 $(srcdir)/mutex/upp.cc
     213        $(BENCH_V_UPP)$(UPPCOMPILE) -DBENCH_N=50000000 $(srcdir)/mutex/upp.cc
    188214
    189215mutex-cfa1$(EXEEXT):
    190         $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=5000000  $(srcdir)/mutex/cfa1.c
     216        $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=5000000  $(srcdir)/mutex/cfa1.cfa
    191217
    192218mutex-cfa2$(EXEEXT):
    193         $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=5000000  $(srcdir)/mutex/cfa2.c
     219        $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=5000000  $(srcdir)/mutex/cfa2.cfa
    194220
    195221mutex-cfa4$(EXEEXT):
    196         $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=5000000  $(srcdir)/mutex/cfa4.c
     222        $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=5000000  $(srcdir)/mutex/cfa4.cfa
    197223
    198224mutex-java_thread$(EXEEXT):
    199         $(AM_V_JAVAC)javac -d $(builddir) $(srcdir)/mutex/JavaThread.java
     225        $(BENCH_V_JAVAC)javac -d $(builddir) $(srcdir)/mutex/JavaThread.java
    200226        @echo "#!/bin/sh" > a.out
    201227        @echo "java JavaThread" >> a.out
     
    212238
    213239signal-pthread_cond$(EXEEXT):
    214         $(AM_V_CC)$(COMPILE)    -DBENCH_N=500000  $(srcdir)/schedint/pthreads.c
     240        $(BENCH_V_CC)$(COMPILE)    -DBENCH_N=500000  $(srcdir)/schedint/pthreads.c
    215241
    216242signal-upp$(EXEEXT):
    217         $(AM_V_UPP)$(UPPCOMPILE) -DBENCH_N=5000000 $(srcdir)/schedint/upp.cc
     243        $(BENCH_V_UPP)$(UPPCOMPILE) -DBENCH_N=5000000 $(srcdir)/schedint/upp.cc
    218244
    219245signal-cfa1$(EXEEXT):
    220         $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=500000  $(srcdir)/schedint/cfa1.c
     246        $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=500000  $(srcdir)/schedint/cfa1.cfa
    221247
    222248signal-cfa2$(EXEEXT):
    223         $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=500000  $(srcdir)/schedint/cfa2.c
     249        $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=500000  $(srcdir)/schedint/cfa2.cfa
    224250
    225251signal-cfa4$(EXEEXT):
    226         $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=500000  $(srcdir)/schedint/cfa4.c
     252        $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=500000  $(srcdir)/schedint/cfa4.cfa
    227253
    228254signal-java_thread$(EXEEXT):
    229         $(AM_V_JAVAC)javac -d $(builddir) $(srcdir)/schedint/JavaThread.java
     255        $(BENCH_V_JAVAC)javac -d $(builddir) $(srcdir)/schedint/JavaThread.java
    230256        @echo "#!/bin/sh" > a.out
    231257        @echo "java JavaThread" >> a.out
     
    241267
    242268waitfor-upp$(EXEEXT):
    243         $(AM_V_UPP)$(UPPCOMPILE) -DBENCH_N=5000000 $(srcdir)/schedext/upp.cc
     269        $(BENCH_V_UPP)$(UPPCOMPILE) -DBENCH_N=5000000 $(srcdir)/schedext/upp.cc
    244270
    245271waitfor-cfa1$(EXEEXT):
    246         $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=500000  $(srcdir)/schedext/cfa1.c
     272        $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=500000  $(srcdir)/schedext/cfa1.cfa
    247273
    248274waitfor-cfa2$(EXEEXT):
    249         $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=500000  $(srcdir)/schedext/cfa2.c
     275        $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=500000  $(srcdir)/schedext/cfa2.cfa
    250276
    251277waitfor-cfa4$(EXEEXT):
    252         $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=500000  $(srcdir)/schedext/cfa4.c
     278        $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=500000  $(srcdir)/schedext/cfa4.cfa
    253279
    254280## =========================================================================================================
     
    264290
    265291creation-cfa_coroutine$(EXEEXT):
    266         $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=10000000 $(srcdir)/creation/cfa_cor.c
     292        $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=10000000 $(srcdir)/creation/cfa_cor.cfa
    267293
    268294creation-cfa_coroutine_eager$(EXEEXT):
    269         $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=10000000 $(srcdir)/creation/cfa_cor.c
     295        $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=10000000 $(srcdir)/creation/cfa_cor.cfa  -DEAGER
    270296
    271297creation-cfa_thread$(EXEEXT):
    272         $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=10000000 $(srcdir)/creation/cfa_thrd.c
     298        $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=10000000 $(srcdir)/creation/cfa_thrd.cfa
    273299
    274300creation-upp_coroutine$(EXEEXT):
    275         $(AM_V_UPP)$(UPPCOMPILE) -DBENCH_N=50000000 $(srcdir)/creation/upp_cor.cc
     301        $(BENCH_V_UPP)$(UPPCOMPILE) -DBENCH_N=50000000 $(srcdir)/creation/upp_cor.cc
    276302
    277303creation-upp_thread$(EXEEXT):
    278         $(AM_V_UPP)$(UPPCOMPILE) -DBENCH_N=50000000 $(srcdir)/creation/upp_thrd.cc
     304        $(BENCH_V_UPP)$(UPPCOMPILE) -DBENCH_N=50000000 $(srcdir)/creation/upp_thrd.cc
    279305
    280306creation-pthread$(EXEEXT):
    281         $(AM_V_CC)$(COMPILE)    -DBENCH_N=250000   $(srcdir)/creation/pthreads.c
     307        $(BENCH_V_CC)$(COMPILE)    -DBENCH_N=250000   $(srcdir)/creation/pthreads.c
    282308
    283309creation-goroutine$(EXEEXT):
    284         $(AM_V_GOC)go build -o a.out $(srcdir)/creation/goroutine.go
     310        $(BENCH_V_GOC)go build -o a.out $(srcdir)/creation/goroutine.go
    285311
    286312creation-java_thread$(EXEEXT):
    287         $(AM_V_JAVAC)javac -d $(builddir) $(srcdir)/creation/JavaThread.java
     313        $(BENCH_V_JAVAC)javac -d $(builddir) $(srcdir)/creation/JavaThread.java
    288314        @echo "#!/bin/sh" > a.out
    289315        @echo "java JavaThread" >> a.out
     
    306332
    307333compile-array$(EXEEXT):
    308         $(AM_V_CFA)$(CFACOMPILE) -fsyntax-only -w $(testdir)/array.c
     334        @$(CFACOMPILE) -fsyntax-only -w $(testdir)/array.cfa
    309335
    310336compile-attributes$(EXEEXT):
    311         $(AM_V_CFA)$(CFACOMPILE) -fsyntax-only -w $(testdir)/attributes.cfa
     337        @$(CFACOMPILE) -fsyntax-only -w $(testdir)/attributes.cfa
    312338
    313339compile-empty$(EXEEXT):
    314         $(AM_V_CFA)$(CFACOMPILE) -fsyntax-only -w $(srcdir)/compile/empty.c
     340        @$(CFACOMPILE) -fsyntax-only -w $(srcdir)/compile/empty.cfa
    315341
    316342compile-expression$(EXEEXT):
    317         $(AM_V_CFA)$(CFACOMPILE) -fsyntax-only -w $(testdir)/expression.c
     343        @$(CFACOMPILE) -fsyntax-only -w $(testdir)/expression.cfa
    318344
    319345compile-io$(EXEEXT):
    320         $(AM_V_CFA)$(CFACOMPILE) -fsyntax-only -w $(testdir)/io1.c
     346        @$(CFACOMPILE) -fsyntax-only -w $(testdir)/io1.cfa
    321347
    322348compile-monitor$(EXEEXT):
    323         $(AM_V_CFA)$(CFACOMPILE) -fsyntax-only -w $(testdir)/concurrent/monitor.c
     349        @$(CFACOMPILE) -fsyntax-only -w $(testdir)/concurrent/monitor.cfa
    324350
    325351compile-operators$(EXEEXT):
    326         $(AM_V_CFA)$(CFACOMPILE) -fsyntax-only -w $(testdir)/operators.c
     352        @$(CFACOMPILE) -fsyntax-only -w $(testdir)/operators.cfa
    327353
    328354compile-thread$(EXEEXT):
    329         $(AM_V_CFA)$(CFACOMPILE) -fsyntax-only -w $(testdir)/concurrent/thread.c
     355        @$(CFACOMPILE) -fsyntax-only -w $(testdir)/concurrent/thread.cfa
    330356
    331357compile-typeof$(EXEEXT):
    332         $(AM_V_CFA)$(CFACOMPILE) -fsyntax-only -w $(testdir)/typeof.c
    333 
     358        @$(CFACOMPILE) -fsyntax-only -w $(testdir)/typeof.cfa
     359
  • benchmark/Makefile.in

    r9d9a451 r53bb8f1  
    111111CONFIG_CLEAN_FILES =
    112112CONFIG_CLEAN_VPATH_FILES =
    113 am_dummy_OBJECTS = c.$(OBJEXT) cxx.$(OBJEXT)
     113am_dummy_OBJECTS = dummyC.$(OBJEXT) dummyCXX.$(OBJEXT)
    114114dummy_OBJECTS = $(am_dummy_OBJECTS)
    115115dummy_LDADD = $(LDADD)
     
    200200DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
    201201ACLOCAL = @ACLOCAL@
    202 ALLOCA = @ALLOCA@
    203202AMTAR = @AMTAR@
    204203AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
     
    364363am__v_GOC_0 = @echo "  GOC     " $@;
    365364am__v_GOC_1 =
     365UPPCC = u++
    366366UPPCOMPILE = $(UPPCC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_UPPFLAGS) $(UPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_CFLAGS) $(CFLAGS)
    367367AM_V_UPP = $(am__v_UPP_@AM_V@)
     
    371371
    372372# applies to both programs
    373 UPPCC = u++
    374373AM_CFLAGS = -O2 -Wall -I$(srcdir) -lrt -pthread
    375374AM_CFAFLAGS = -quiet -in-tree -nodebug
    376375AM_UPPFLAGS = -quiet -nodebug -multi
    377 TOOLSDIR = ${abs_top_srcdir}/tools/
    378 REPEAT = ${TOOLSDIR}repeat
    379 STATS = ${TOOLSDIR}stat.py
     376BENCH_V_CC = $(__bench_v_CC_$(__quiet))
     377BENCH_V_CFA = $(__bench_v_CFA_$(__quiet))
     378BENCH_V_CXX = $(__bench_v_CXX_$(__quiet))
     379BENCH_V_GOC = $(__bench_v_GOC_$(__quiet))
     380BENCH_V_JAVAC = $(__bench_v_JAVAC_$(__quiet))
     381BENCH_V_UPP = $(__bench_v_UPP_$(__quiet))
     382__quiet = verbose
     383__bench_v_CC_quiet = @
     384__bench_v_CFA_quiet = @
     385__bench_v_CXX_quiet = @
     386__bench_v_GOC_quiet = @
     387__bench_v_JAVAC_quiet = @
     388__bench_v_UPP_quiet = @
     389__bench_v_CC_verbose = $(AM_V_CC)
     390__bench_v_CFA_verbose = $(AM_V_CFA)
     391__bench_v_CXX_verbose = $(AM_V_CXX)
     392__bench_v_GOC_verbose = $(AM_V_GOC)
     393__bench_v_JAVAC_verbose = $(AM_V_JAVAC)
     394__bench_v_UPP_verbose = $(AM_V_UPP)
     395TOOLSDIR = ${abs_top_builddir}/tools/
     396REPEAT = ${abs_top_builddir}/tools/repeat
     397STATS = ${abs_top_srcdir}/tools/stat.py
    380398repeats = 30
    381399skipcompile = no
    382400TIME_FORMAT = "%E"
    383401PRINT_FORMAT = %20s: #Comments needed for spacing
    384 dummy_SOURCES = c.c cxx.cpp
     402dummy_SOURCES = dummyC.c dummyCXX.cpp
    385403CTXSWITCH_DEPEND = loop.run function.run fetch_add.run \
    386404        ctxswitch-pthread.run ctxswitch-cfa_coroutine.run \
     
    435453        -rm -f *.tab.c
    436454
    437 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c.Po@am__quote@
    438 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cxx.Po@am__quote@
     455@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dummyC.Po@am__quote@
     456@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dummyCXX.Po@am__quote@
    439457
    440458.c.o:
     
    706724        $(am__mv) $$depbase.Tpo $$depbase.Plo
    707725
    708 #prevent any tests in parallel
     726dummyC.c:
     727        @echo "int main() { return 0; }" > ${@}
     728
     729dummyCXX.cpp:
     730        @echo "int main() { return 0; }" > ${@}
     731
    709732.NOTPARALLEL:
    710733
     
    721744
    722745%.runquiet :
    723         @+make $(basename $@) CFLAGS="-w"
     746        @+make $(basename $@) CFLAGS="-w" __quiet=quiet
    724747        @taskset -c 1 ./a.out
    725748        @rm -f a.out
     
    730753
    731754${REPEAT} :
    732         @+make -C ${TOOLSDIR} repeat
     755        @+make -C ${abs_top_builddir}/tools repeat
    733756
    734757jenkins$(EXEEXT):
     
    768791
    769792loop$(EXEEXT):
    770         $(AM_V_CC)$(COMPILE) -DBENCH_N=5000000000 $(srcdir)/loop.c
     793        $(BENCH_V_CC)$(COMPILE) -DBENCH_N=5000000000 $(srcdir)/loop.c
    771794
    772795function$(EXEEXT):
    773         $(AM_V_CC)$(COMPILE) -DBENCH_N=5000000000 $(srcdir)/function.c
     796        $(BENCH_V_CC)$(COMPILE) -DBENCH_N=5000000000 $(srcdir)/function.c
    774797
    775798fetch_add$(EXEEXT):
    776         $(AM_V_CC)$(COMPILE) -DBENCH_N=500000000  $(srcdir)/fetch_add.c
     799        $(BENCH_V_CC)$(COMPILE) -DBENCH_N=500000000  $(srcdir)/fetch_add.c
    777800
    778801@WITH_LIBFIBRE_TRUE@ctxswitch-kos_fibre$(EXEEXT):
    779 @WITH_LIBFIBRE_TRUE@    $(AM_V_CXX)$(CXXCOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/kos_fibre.cpp  -I$(LIBFIBRE_DIR) -lfibre
     802@WITH_LIBFIBRE_TRUE@    $(BENCH_V_CXX)$(CXXCOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/kos_fibre.cpp  -I$(LIBFIBRE_DIR) -lfibre
    780803
    781804@WITH_LIBFIBRE_TRUE@ctxswitch-kos_fibre2$(EXEEXT):
    782 @WITH_LIBFIBRE_TRUE@    $(AM_V_CXX)$(CXXCOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/kos_fibre2.cpp -I$(LIBFIBRE_DIR) -lfibre
     805@WITH_LIBFIBRE_TRUE@    $(BENCH_V_CXX)$(CXXCOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/kos_fibre2.cpp -I$(LIBFIBRE_DIR) -lfibre
    783806
    784807ctxswitch$(EXEEXT): $(CTXSWITCH_DEPEND)
    785808
    786809ctxswitch-pthread$(EXEEXT):
    787         $(AM_V_CC)$(COMPILE)    -DBENCH_N=50000000 $(srcdir)/ctxswitch/pthreads.c
     810        $(BENCH_V_CC)$(COMPILE)    -DBENCH_N=50000000 $(srcdir)/ctxswitch/pthreads.c
    788811
    789812ctxswitch-cfa_coroutine$(EXEEXT):
    790         $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/cfa_cor.c
     813        $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/cfa_cor.cfa
    791814
    792815ctxswitch-cfa_thread$(EXEEXT):
    793         $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/cfa_thrd.c
     816        $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/cfa_thrd.cfa
    794817
    795818ctxswitch-cfa_thread2$(EXEEXT):
    796         $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/cfa_thrd2.c
     819        $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/cfa_thrd2.cfa
    797820
    798821ctxswitch-upp_coroutine$(EXEEXT):
    799         $(AM_V_UPP)$(UPPCOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/upp_cor.cc
     822        $(BENCH_V_UPP)$(UPPCOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/upp_cor.cc
    800823
    801824ctxswitch-upp_thread$(EXEEXT):
    802         $(AM_V_UPP)$(UPPCOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/upp_thrd.cc
     825        $(BENCH_V_UPP)$(UPPCOMPILE) -DBENCH_N=50000000 $(srcdir)/ctxswitch/upp_thrd.cc
    803826
    804827ctxswitch-goroutine$(EXEEXT):
    805         $(AM_V_GOC)go build -o a.out $(srcdir)/ctxswitch/goroutine.go
     828        $(BENCH_V_GOC)go build -o a.out $(srcdir)/ctxswitch/goroutine.go
    806829
    807830ctxswitch-java_thread$(EXEEXT):
    808         $(AM_V_JAVAC)javac -d $(builddir) $(srcdir)/ctxswitch/JavaThread.java
     831        $(BENCH_V_JAVAC)javac -d $(builddir) $(srcdir)/ctxswitch/JavaThread.java
    809832        @echo "#!/bin/sh" > a.out
    810833        @echo "java JavaThread" >> a.out
     
    823846
    824847mutex-pthread_lock$(EXEEXT):
    825         $(AM_V_CC)$(COMPILE)    -DBENCH_N=50000000 $(srcdir)/mutex/pthreads.c
     848        $(BENCH_V_CC)$(COMPILE)    -DBENCH_N=50000000 $(srcdir)/mutex/pthreads.c
    826849
    827850mutex-upp$(EXEEXT):
    828         $(AM_V_UPP)$(UPPCOMPILE) -DBENCH_N=50000000 $(srcdir)/mutex/upp.cc
     851        $(BENCH_V_UPP)$(UPPCOMPILE) -DBENCH_N=50000000 $(srcdir)/mutex/upp.cc
    829852
    830853mutex-cfa1$(EXEEXT):
    831         $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=5000000  $(srcdir)/mutex/cfa1.c
     854        $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=5000000  $(srcdir)/mutex/cfa1.cfa
    832855
    833856mutex-cfa2$(EXEEXT):
    834         $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=5000000  $(srcdir)/mutex/cfa2.c
     857        $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=5000000  $(srcdir)/mutex/cfa2.cfa
    835858
    836859mutex-cfa4$(EXEEXT):
    837         $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=5000000  $(srcdir)/mutex/cfa4.c
     860        $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=5000000  $(srcdir)/mutex/cfa4.cfa
    838861
    839862mutex-java_thread$(EXEEXT):
    840         $(AM_V_JAVAC)javac -d $(builddir) $(srcdir)/mutex/JavaThread.java
     863        $(BENCH_V_JAVAC)javac -d $(builddir) $(srcdir)/mutex/JavaThread.java
    841864        @echo "#!/bin/sh" > a.out
    842865        @echo "java JavaThread" >> a.out
     
    852875
    853876signal-pthread_cond$(EXEEXT):
    854         $(AM_V_CC)$(COMPILE)    -DBENCH_N=500000  $(srcdir)/schedint/pthreads.c
     877        $(BENCH_V_CC)$(COMPILE)    -DBENCH_N=500000  $(srcdir)/schedint/pthreads.c
    855878
    856879signal-upp$(EXEEXT):
    857         $(AM_V_UPP)$(UPPCOMPILE) -DBENCH_N=5000000 $(srcdir)/schedint/upp.cc
     880        $(BENCH_V_UPP)$(UPPCOMPILE) -DBENCH_N=5000000 $(srcdir)/schedint/upp.cc
    858881
    859882signal-cfa1$(EXEEXT):
    860         $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=500000  $(srcdir)/schedint/cfa1.c
     883        $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=500000  $(srcdir)/schedint/cfa1.cfa
    861884
    862885signal-cfa2$(EXEEXT):
    863         $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=500000  $(srcdir)/schedint/cfa2.c
     886        $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=500000  $(srcdir)/schedint/cfa2.cfa
    864887
    865888signal-cfa4$(EXEEXT):
    866         $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=500000  $(srcdir)/schedint/cfa4.c
     889        $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=500000  $(srcdir)/schedint/cfa4.cfa
    867890
    868891signal-java_thread$(EXEEXT):
    869         $(AM_V_JAVAC)javac -d $(builddir) $(srcdir)/schedint/JavaThread.java
     892        $(BENCH_V_JAVAC)javac -d $(builddir) $(srcdir)/schedint/JavaThread.java
    870893        @echo "#!/bin/sh" > a.out
    871894        @echo "java JavaThread" >> a.out
     
    879902
    880903waitfor-upp$(EXEEXT):
    881         $(AM_V_UPP)$(UPPCOMPILE) -DBENCH_N=5000000 $(srcdir)/schedext/upp.cc
     904        $(BENCH_V_UPP)$(UPPCOMPILE) -DBENCH_N=5000000 $(srcdir)/schedext/upp.cc
    882905
    883906waitfor-cfa1$(EXEEXT):
    884         $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=500000  $(srcdir)/schedext/cfa1.c
     907        $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=500000  $(srcdir)/schedext/cfa1.cfa
    885908
    886909waitfor-cfa2$(EXEEXT):
    887         $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=500000  $(srcdir)/schedext/cfa2.c
     910        $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=500000  $(srcdir)/schedext/cfa2.cfa
    888911
    889912waitfor-cfa4$(EXEEXT):
    890         $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=500000  $(srcdir)/schedext/cfa4.c
     913        $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=500000  $(srcdir)/schedext/cfa4.cfa
    891914
    892915creation$(EXEEXT) :\
     
    901924
    902925creation-cfa_coroutine$(EXEEXT):
    903         $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=10000000 $(srcdir)/creation/cfa_cor.c
     926        $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=10000000 $(srcdir)/creation/cfa_cor.cfa
    904927
    905928creation-cfa_coroutine_eager$(EXEEXT):
    906         $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=10000000 $(srcdir)/creation/cfa_cor.c
     929        $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=10000000 $(srcdir)/creation/cfa_cor.cfa  -DEAGER
    907930
    908931creation-cfa_thread$(EXEEXT):
    909         $(AM_V_CFA)$(CFACOMPILE) -DBENCH_N=10000000 $(srcdir)/creation/cfa_thrd.c
     932        $(BENCH_V_CFA)$(CFACOMPILE) -DBENCH_N=10000000 $(srcdir)/creation/cfa_thrd.cfa
    910933
    911934creation-upp_coroutine$(EXEEXT):
    912         $(AM_V_UPP)$(UPPCOMPILE) -DBENCH_N=50000000 $(srcdir)/creation/upp_cor.cc
     935        $(BENCH_V_UPP)$(UPPCOMPILE) -DBENCH_N=50000000 $(srcdir)/creation/upp_cor.cc
    913936
    914937creation-upp_thread$(EXEEXT):
    915         $(AM_V_UPP)$(UPPCOMPILE) -DBENCH_N=50000000 $(srcdir)/creation/upp_thrd.cc
     938        $(BENCH_V_UPP)$(UPPCOMPILE) -DBENCH_N=50000000 $(srcdir)/creation/upp_thrd.cc
    916939
    917940creation-pthread$(EXEEXT):
    918         $(AM_V_CC)$(COMPILE)    -DBENCH_N=250000   $(srcdir)/creation/pthreads.c
     941        $(BENCH_V_CC)$(COMPILE)    -DBENCH_N=250000   $(srcdir)/creation/pthreads.c
    919942
    920943creation-goroutine$(EXEEXT):
    921         $(AM_V_GOC)go build -o a.out $(srcdir)/creation/goroutine.go
     944        $(BENCH_V_GOC)go build -o a.out $(srcdir)/creation/goroutine.go
    922945
    923946creation-java_thread$(EXEEXT):
    924         $(AM_V_JAVAC)javac -d $(builddir) $(srcdir)/creation/JavaThread.java
     947        $(BENCH_V_JAVAC)javac -d $(builddir) $(srcdir)/creation/JavaThread.java
    925948        @echo "#!/bin/sh" > a.out
    926949        @echo "java JavaThread" >> a.out
     
    938961
    939962compile-array$(EXEEXT):
    940         $(AM_V_CFA)$(CFACOMPILE) -fsyntax-only -w $(testdir)/array.c
     963        @$(CFACOMPILE) -fsyntax-only -w $(testdir)/array.cfa
    941964
    942965compile-attributes$(EXEEXT):
    943         $(AM_V_CFA)$(CFACOMPILE) -fsyntax-only -w $(testdir)/attributes.cfa
     966        @$(CFACOMPILE) -fsyntax-only -w $(testdir)/attributes.cfa
    944967
    945968compile-empty$(EXEEXT):
    946         $(AM_V_CFA)$(CFACOMPILE) -fsyntax-only -w $(srcdir)/compile/empty.c
     969        @$(CFACOMPILE) -fsyntax-only -w $(srcdir)/compile/empty.cfa
    947970
    948971compile-expression$(EXEEXT):
    949         $(AM_V_CFA)$(CFACOMPILE) -fsyntax-only -w $(testdir)/expression.c
     972        @$(CFACOMPILE) -fsyntax-only -w $(testdir)/expression.cfa
    950973
    951974compile-io$(EXEEXT):
    952         $(AM_V_CFA)$(CFACOMPILE) -fsyntax-only -w $(testdir)/io1.c
     975        @$(CFACOMPILE) -fsyntax-only -w $(testdir)/io1.cfa
    953976
    954977compile-monitor$(EXEEXT):
    955         $(AM_V_CFA)$(CFACOMPILE) -fsyntax-only -w $(testdir)/concurrent/monitor.c
     978        @$(CFACOMPILE) -fsyntax-only -w $(testdir)/concurrent/monitor.cfa
    956979
    957980compile-operators$(EXEEXT):
    958         $(AM_V_CFA)$(CFACOMPILE) -fsyntax-only -w $(testdir)/operators.c
     981        @$(CFACOMPILE) -fsyntax-only -w $(testdir)/operators.cfa
    959982
    960983compile-thread$(EXEEXT):
    961         $(AM_V_CFA)$(CFACOMPILE) -fsyntax-only -w $(testdir)/concurrent/thread.c
     984        @$(CFACOMPILE) -fsyntax-only -w $(testdir)/concurrent/thread.cfa
    962985
    963986compile-typeof$(EXEEXT):
    964         $(AM_V_CFA)$(CFACOMPILE) -fsyntax-only -w $(testdir)/typeof.c
     987        @$(CFACOMPILE) -fsyntax-only -w $(testdir)/typeof.cfa
    965988
    966989# Tell versions [3.59,3.63) of GNU make to not export all variables.
  • configure

    r9d9a451 r53bb8f1  
    637637LIBOBJS
    638638CFA_BACKEND_CC
    639 ALLOCA
    640639WITH_LIBFIBRE_FALSE
    641640WITH_LIBFIBRE_TRUE
     
    19611960} # ac_fn_cxx_try_link
    19621961
    1963 # ac_fn_c_check_type LINENO TYPE VAR INCLUDES
    1964 # -------------------------------------------
    1965 # Tests whether TYPE exists after having included INCLUDES, setting cache
    1966 # variable VAR accordingly.
    1967 ac_fn_c_check_type ()
    1968 {
    1969   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
    1970   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
    1971 $as_echo_n "checking for $2... " >&6; }
    1972 if eval \${$3+:} false; then :
    1973   $as_echo_n "(cached) " >&6
    1974 else
    1975   eval "$3=no"
    1976   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
    1977 /* end confdefs.h.  */
    1978 $4
    1979 int
    1980 main ()
    1981 {
    1982 if (sizeof ($2))
    1983          return 0;
    1984   ;
    1985   return 0;
    1986 }
    1987 _ACEOF
    1988 if ac_fn_c_try_compile "$LINENO"; then :
    1989   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
    1990 /* end confdefs.h.  */
    1991 $4
    1992 int
    1993 main ()
    1994 {
    1995 if (sizeof (($2)))
    1996             return 0;
    1997   ;
    1998   return 0;
    1999 }
    2000 _ACEOF
    2001 if ac_fn_c_try_compile "$LINENO"; then :
    2002 
    2003 else
    2004   eval "$3=yes"
    2005 fi
    2006 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
    2007 fi
    2008 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
    2009 fi
    2010 eval ac_res=\$$3
    2011                { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
    2012 $as_echo "$ac_res" >&6; }
    2013   eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
    2014 
    2015 } # ac_fn_c_check_type
    2016 
    20171962# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
    20181963# -------------------------------------------------------
     
    21062051} # ac_fn_c_check_header_mongrel
    21072052
    2108 # ac_fn_c_find_intX_t LINENO BITS VAR
    2109 # -----------------------------------
    2110 # Finds a signed integer type with width BITS, setting cache variable VAR
    2111 # accordingly.
    2112 ac_fn_c_find_intX_t ()
     2053# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
     2054# -------------------------------------------
     2055# Tests whether TYPE exists after having included INCLUDES, setting cache
     2056# variable VAR accordingly.
     2057ac_fn_c_check_type ()
    21132058{
    21142059  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
    2115   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for int$2_t" >&5
    2116 $as_echo_n "checking for int$2_t... " >&6; }
     2060  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
     2061$as_echo_n "checking for $2... " >&6; }
    21172062if eval \${$3+:} false; then :
    21182063  $as_echo_n "(cached) " >&6
    21192064else
    21202065  eval "$3=no"
    2121      # Order is important - never check a type that is potentially smaller
    2122      # than half of the expected target width.
    2123      for ac_type in int$2_t 'int' 'long int' \
    2124          'long long int' 'short int' 'signed char'; do
    2125        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
     2066  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
    21262067/* end confdefs.h.  */
    2127 $ac_includes_default
    2128              enum { N = $2 / 2 - 1 };
     2068$4
    21292069int
    21302070main ()
    21312071{
    2132 static int test_array [1 - 2 * !(0 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1))];
    2133 test_array [0] = 0;
    2134 return test_array [0];
    2135 
     2072if (sizeof ($2))
     2073         return 0;
    21362074  ;
    21372075  return 0;
     
    21412079  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
    21422080/* end confdefs.h.  */
    2143 $ac_includes_default
    2144                 enum { N = $2 / 2 - 1 };
     2081$4
    21452082int
    21462083main ()
    21472084{
    2148 static int test_array [1 - 2 * !(($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1)
    2149                  < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 2))];
    2150 test_array [0] = 0;
    2151 return test_array [0];
    2152 
     2085if (sizeof (($2)))
     2086            return 0;
    21532087  ;
    21542088  return 0;
     
    21582092
    21592093else
    2160   case $ac_type in #(
    2161   int$2_t) :
    2162     eval "$3=yes" ;; #(
    2163   *) :
    2164     eval "$3=\$ac_type" ;;
    2165 esac
     2094  eval "$3=yes"
    21662095fi
    21672096rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
    21682097fi
    21692098rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
    2170        if eval test \"x\$"$3"\" = x"no"; then :
    2171 
    2172 else
    2173   break
    2174 fi
    2175      done
    21762099fi
    21772100eval ac_res=\$$3
     
    21802103  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
    21812104
    2182 } # ac_fn_c_find_intX_t
    2183 
    2184 # ac_fn_c_find_uintX_t LINENO BITS VAR
    2185 # ------------------------------------
    2186 # Finds an unsigned integer type with width BITS, setting cache variable VAR
    2187 # accordingly.
    2188 ac_fn_c_find_uintX_t ()
    2189 {
    2190   as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
    2191   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5
    2192 $as_echo_n "checking for uint$2_t... " >&6; }
    2193 if eval \${$3+:} false; then :
    2194   $as_echo_n "(cached) " >&6
    2195 else
    2196   eval "$3=no"
    2197      # Order is important - never check a type that is potentially smaller
    2198      # than half of the expected target width.
    2199      for ac_type in uint$2_t 'unsigned int' 'unsigned long int' \
    2200          'unsigned long long int' 'unsigned short int' 'unsigned char'; do
    2201        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
    2202 /* end confdefs.h.  */
    2203 $ac_includes_default
    2204 int
    2205 main ()
    2206 {
    2207 static int test_array [1 - 2 * !((($ac_type) -1 >> ($2 / 2 - 1)) >> ($2 / 2 - 1) == 3)];
    2208 test_array [0] = 0;
    2209 return test_array [0];
    2210 
    2211   ;
    2212   return 0;
    2213 }
    2214 _ACEOF
    2215 if ac_fn_c_try_compile "$LINENO"; then :
    2216   case $ac_type in #(
    2217   uint$2_t) :
    2218     eval "$3=yes" ;; #(
    2219   *) :
    2220     eval "$3=\$ac_type" ;;
    2221 esac
    2222 fi
    2223 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
    2224        if eval test \"x\$"$3"\" = x"no"; then :
    2225 
    2226 else
    2227   break
    2228 fi
    2229      done
    2230 fi
    2231 eval ac_res=\$$3
    2232                { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
    2233 $as_echo "$ac_res" >&6; }
    2234   eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
    2235 
    2236 } # ac_fn_c_find_uintX_t
     2105} # ac_fn_c_check_type
    22372106cat >config.log <<_ACEOF
    22382107This file contains any messages produced by compilers while
     
    26672536
    26682537
     2538# http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=blob_plain;f=m4/ax_check_compile_flag.m4
     2539
    26692540
    26702541# don't use the default CFLAGS as they unconditonnaly add -O2
     
    51835054
    51845055
    5185         # deprecated
    51865056# These are often not installed and people miss seeing the "no", so stop the configure.
    51875057for ac_prog in 'bison -y' byacc
     
    1673416604
    1673516605
    16736 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
    16737 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
    16738 set x ${MAKE-make}
    16739 ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
    16740 if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then :
    16741   $as_echo_n "(cached) " >&6
    16742 else
    16743   cat >conftest.make <<\_ACEOF
    16744 SHELL = /bin/sh
    16745 all:
    16746         @echo '@@@%%%=$(MAKE)=@@@%%%'
    16747 _ACEOF
    16748 # GNU make sometimes prints "make[1]: Entering ...", which would confuse us.
    16749 case `${MAKE-make} -f conftest.make 2>/dev/null` in
    16750   *@@@%%%=?*=@@@%%%*)
    16751     eval ac_cv_prog_make_${ac_make}_set=yes;;
    16752   *)
    16753     eval ac_cv_prog_make_${ac_make}_set=no;;
    16754 esac
    16755 rm -f conftest.make
    16756 fi
    16757 if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
    16758   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
    16759 $as_echo "yes" >&6; }
    16760   SET_MAKE=
    16761 else
    16762   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
    16763 $as_echo "no" >&6; }
    16764   SET_MAKE="MAKE=${MAKE-make}"
    16765 fi
    16766 
    1676716606
    1676816607# Checks for libraries.
     
    1681916658
    1682016659# Checks for header files.
    16821 ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"
    16822 if test "x$ac_cv_type_size_t" = xyes; then :
    16823 
    16824 else
    16825 
    16826 cat >>confdefs.h <<_ACEOF
    16827 #define size_t unsigned int
    16828 _ACEOF
    16829 
    16830 fi
    16831 
    16832 # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
    16833 # for constant arguments.  Useless!
    16834 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5
    16835 $as_echo_n "checking for working alloca.h... " >&6; }
    16836 if ${ac_cv_working_alloca_h+:} false; then :
    16837   $as_echo_n "(cached) " >&6
    16838 else
    16839   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
    16840 /* end confdefs.h.  */
    16841 #include <alloca.h>
    16842 int
    16843 main ()
    16844 {
    16845 char *p = (char *) alloca (2 * sizeof (int));
    16846                           if (p) return 0;
    16847   ;
    16848   return 0;
    16849 }
    16850 _ACEOF
    16851 if ac_fn_c_try_link "$LINENO"; then :
    16852   ac_cv_working_alloca_h=yes
    16853 else
    16854   ac_cv_working_alloca_h=no
    16855 fi
    16856 rm -f core conftest.err conftest.$ac_objext \
    16857     conftest$ac_exeext conftest.$ac_ext
    16858 fi
    16859 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5
    16860 $as_echo "$ac_cv_working_alloca_h" >&6; }
    16861 if test $ac_cv_working_alloca_h = yes; then
    16862 
    16863 $as_echo "#define HAVE_ALLOCA_H 1" >>confdefs.h
    16864 
    16865 fi
    16866 
    16867 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5
    16868 $as_echo_n "checking for alloca... " >&6; }
    16869 if ${ac_cv_func_alloca_works+:} false; then :
    16870   $as_echo_n "(cached) " >&6
    16871 else
    16872   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
    16873 /* end confdefs.h.  */
    16874 #ifdef __GNUC__
    16875 # define alloca __builtin_alloca
    16876 #else
    16877 # ifdef _MSC_VER
    16878 #  include <malloc.h>
    16879 #  define alloca _alloca
    16880 # else
    16881 #  ifdef HAVE_ALLOCA_H
    16882 #   include <alloca.h>
    16883 #  else
    16884 #   ifdef _AIX
    16885  #pragma alloca
    16886 #   else
    16887 #    ifndef alloca /* predefined by HP cc +Olibcalls */
    16888 void *alloca (size_t);
    16889 #    endif
    16890 #   endif
    16891 #  endif
    16892 # endif
    16893 #endif
    16894 
    16895 int
    16896 main ()
    16897 {
    16898 char *p = (char *) alloca (1);
    16899                                     if (p) return 0;
    16900   ;
    16901   return 0;
    16902 }
    16903 _ACEOF
    16904 if ac_fn_c_try_link "$LINENO"; then :
    16905   ac_cv_func_alloca_works=yes
    16906 else
    16907   ac_cv_func_alloca_works=no
    16908 fi
    16909 rm -f core conftest.err conftest.$ac_objext \
    16910     conftest$ac_exeext conftest.$ac_ext
    16911 fi
    16912 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5
    16913 $as_echo "$ac_cv_func_alloca_works" >&6; }
    16914 
    16915 if test $ac_cv_func_alloca_works = yes; then
    16916 
    16917 $as_echo "#define HAVE_ALLOCA 1" >>confdefs.h
    16918 
    16919 else
    16920   # The SVR3 libPW and SVR4 libucb both contain incompatible functions
    16921 # that cause trouble.  Some versions do not even contain alloca or
    16922 # contain a buggy version.  If you still want to use their alloca,
    16923 # use ar to extract alloca.o from them instead of compiling alloca.c.
    16924 
    16925 ALLOCA=\${LIBOBJDIR}alloca.$ac_objext
    16926 
    16927 $as_echo "#define C_ALLOCA 1" >>confdefs.h
    16928 
    16929 
    16930 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \`alloca.c' needs Cray hooks" >&5
    16931 $as_echo_n "checking whether \`alloca.c' needs Cray hooks... " >&6; }
    16932 if ${ac_cv_os_cray+:} false; then :
    16933   $as_echo_n "(cached) " >&6
    16934 else
    16935   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
    16936 /* end confdefs.h.  */
    16937 #if defined CRAY && ! defined CRAY2
    16938 webecray
    16939 #else
    16940 wenotbecray
    16941 #endif
    16942 
    16943 _ACEOF
    16944 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
    16945   $EGREP "webecray" >/dev/null 2>&1; then :
    16946   ac_cv_os_cray=yes
    16947 else
    16948   ac_cv_os_cray=no
    16949 fi
    16950 rm -f conftest*
    16951 
    16952 fi
    16953 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_os_cray" >&5
    16954 $as_echo "$ac_cv_os_cray" >&6; }
    16955 if test $ac_cv_os_cray = yes; then
    16956   for ac_func in _getb67 GETB67 getb67; do
    16957     as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
    16958 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
    16959 if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
    16960 
    16961 cat >>confdefs.h <<_ACEOF
    16962 #define CRAY_STACKSEG_END $ac_func
    16963 _ACEOF
    16964 
    16965     break
    16966 fi
    16967 
    16968   done
    16969 fi
    16970 
    16971 { $as_echo "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5
    16972 $as_echo_n "checking stack direction for C alloca... " >&6; }
    16973 if ${ac_cv_c_stack_direction+:} false; then :
    16974   $as_echo_n "(cached) " >&6
    16975 else
    16976   if test "$cross_compiling" = yes; then :
    16977   ac_cv_c_stack_direction=0
    16978 else
    16979   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
    16980 /* end confdefs.h.  */
    16981 $ac_includes_default
    16982 int
    16983 find_stack_direction (int *addr, int depth)
    16984 {
    16985   int dir, dummy = 0;
    16986   if (! addr)
    16987     addr = &dummy;
    16988   *addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1;
    16989   dir = depth ? find_stack_direction (addr, depth - 1) : 0;
    16990   return dir + dummy;
    16991 }
    16992 
    16993 int
    16994 main (int argc, char **argv)
    16995 {
    16996   return find_stack_direction (0, argc + !argv + 20) < 0;
    16997 }
    16998 _ACEOF
    16999 if ac_fn_c_try_run "$LINENO"; then :
    17000   ac_cv_c_stack_direction=1
    17001 else
    17002   ac_cv_c_stack_direction=-1
    17003 fi
    17004 rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
    17005   conftest.$ac_objext conftest.beam conftest.$ac_ext
    17006 fi
    17007 
    17008 fi
    17009 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stack_direction" >&5
    17010 $as_echo "$ac_cv_c_stack_direction" >&6; }
    17011 cat >>confdefs.h <<_ACEOF
    17012 #define STACK_DIRECTION $ac_cv_c_stack_direction
    17013 _ACEOF
    17014 
    17015 
    17016 fi
    17017 
    17018 for ac_header in fenv.h float.h inttypes.h libintl.h limits.h malloc.h stddef.h stdlib.h string.h unistd.h
     16660for ac_header in libintl.h malloc.h unistd.h
    1701916661do :
    1702016662  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
     
    1702516667_ACEOF
    1702616668
     16669else
     16670  echo "Error: Missing required header"; exit 1
    1702716671fi
    1702816672
     
    1703116675
    1703216676# Checks for typedefs, structures, and compiler characteristics.
    17033 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5
    17034 $as_echo_n "checking for stdbool.h that conforms to C99... " >&6; }
    17035 if ${ac_cv_header_stdbool_h+:} false; then :
     16677ac_fn_c_check_type "$LINENO" "_Float32" "ac_cv_type__Float32" "
     16678"
     16679if test "x$ac_cv_type__Float32" = xyes; then :
     16680
     16681cat >>confdefs.h <<_ACEOF
     16682#define HAVE__FLOAT32 1
     16683_ACEOF
     16684
     16685
     16686$as_echo "#define HAVE_KEYWORDS_FLOATXX /**/" >>confdefs.h
     16687
     16688fi
     16689
     16690
     16691# Checks for compiler flags.
     16692{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -Wcast-function-type" >&5
     16693$as_echo_n "checking whether C compiler accepts -Wcast-function-type... " >&6; }
     16694if ${m4cfa_cv_check_cflags___Wcast_function_type+:} false; then :
    1703616695  $as_echo_n "(cached) " >&6
    1703716696else
    17038   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
     16697
     16698        m4cfa_check_save_flags=$CFLAGS
     16699        CFLAGS="$CFLAGS  -Wcast-function-type"
     16700        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
    1703916701/* end confdefs.h.  */
    17040 
    17041              #include <stdbool.h>
    17042              #ifndef bool
    17043               "error: bool is not defined"
    17044              #endif
    17045              #ifndef false
    17046               "error: false is not defined"
    17047              #endif
    17048              #if false
    17049               "error: false is not 0"
    17050              #endif
    17051              #ifndef true
    17052               "error: true is not defined"
    17053              #endif
    17054              #if true != 1
    17055               "error: true is not 1"
    17056              #endif
    17057              #ifndef __bool_true_false_are_defined
    17058               "error: __bool_true_false_are_defined is not defined"
    17059              #endif
    17060 
    17061              struct s { _Bool s: 1; _Bool t; } s;
    17062 
    17063              char a[true == 1 ? 1 : -1];
    17064              char b[false == 0 ? 1 : -1];
    17065              char c[__bool_true_false_are_defined == 1 ? 1 : -1];
    17066              char d[(bool) 0.5 == true ? 1 : -1];
    17067              /* See body of main program for 'e'.  */
    17068              char f[(_Bool) 0.0 == false ? 1 : -1];
    17069              char g[true];
    17070              char h[sizeof (_Bool)];
    17071              char i[sizeof s.t];
    17072              enum { j = false, k = true, l = false * true, m = true * 256 };
    17073              /* The following fails for
    17074                 HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */
    17075              _Bool n[m];
    17076              char o[sizeof n == m * sizeof n[0] ? 1 : -1];
    17077              char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
    17078              /* Catch a bug in an HP-UX C compiler.  See
    17079                 http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
    17080                 http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
    17081               */
    17082              _Bool q = true;
    17083              _Bool *pq = &q;
    1708416702
    1708516703int
    1708616704main ()
    1708716705{
    17088 
    17089              bool e = &s;
    17090              *pq |= q;
    17091              *pq |= ! q;
    17092              /* Refer to every declared value, to avoid compiler optimizations.  */
    17093              return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l
    17094                      + !m + !n + !o + !p + !q + !pq);
    1709516706
    1709616707  ;
     
    1709916710_ACEOF
    1710016711if ac_fn_c_try_compile "$LINENO"; then :
    17101   ac_cv_header_stdbool_h=yes
    17102 else
    17103   ac_cv_header_stdbool_h=no
     16712  m4cfa_cv_check_cflags___Wcast_function_type=yes
     16713else
     16714  m4cfa_cv_check_cflags___Wcast_function_type=no
    1710416715fi
    1710516716rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
    17106 fi
    17107 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5
    17108 $as_echo "$ac_cv_header_stdbool_h" >&6; }
    17109    ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default"
    17110 if test "x$ac_cv_type__Bool" = xyes; then :
    17111 
    17112 cat >>confdefs.h <<_ACEOF
    17113 #define HAVE__BOOL 1
    17114 _ACEOF
    17115 
    17116 
    17117 fi
    17118 
    17119 
    17120 if test $ac_cv_header_stdbool_h = yes; then
    17121 
    17122 $as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h
    17123 
    17124 fi
    17125 
    17126 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5
    17127 $as_echo_n "checking for inline... " >&6; }
    17128 if ${ac_cv_c_inline+:} false; then :
    17129   $as_echo_n "(cached) " >&6
    17130 else
    17131   ac_cv_c_inline=no
    17132 for ac_kw in inline __inline__ __inline; do
    17133   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
    17134 /* end confdefs.h.  */
    17135 #ifndef __cplusplus
    17136 typedef int foo_t;
    17137 static $ac_kw foo_t static_foo () {return 0; }
    17138 $ac_kw foo_t foo () {return 0; }
    17139 #endif
    17140 
    17141 _ACEOF
    17142 if ac_fn_c_try_compile "$LINENO"; then :
    17143   ac_cv_c_inline=$ac_kw
    17144 fi
    17145 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
    17146   test "$ac_cv_c_inline" != no && break
    17147 done
    17148 
    17149 fi
    17150 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5
    17151 $as_echo "$ac_cv_c_inline" >&6; }
    17152 
    17153 case $ac_cv_c_inline in
    17154   inline | yes) ;;
    17155   *)
    17156     case $ac_cv_c_inline in
    17157       no) ac_val=;;
    17158       *) ac_val=$ac_cv_c_inline;;
    17159     esac
    17160     cat >>confdefs.h <<_ACEOF
    17161 #ifndef __cplusplus
    17162 #define inline $ac_val
    17163 #endif
    17164 _ACEOF
    17165     ;;
    17166 esac
    17167 
    17168 ac_fn_c_find_intX_t "$LINENO" "16" "ac_cv_c_int16_t"
    17169 case $ac_cv_c_int16_t in #(
    17170   no|yes) ;; #(
    17171   *)
    17172 
    17173 cat >>confdefs.h <<_ACEOF
    17174 #define int16_t $ac_cv_c_int16_t
    17175 _ACEOF
    17176 ;;
    17177 esac
    17178 
    17179 ac_fn_c_find_intX_t "$LINENO" "32" "ac_cv_c_int32_t"
    17180 case $ac_cv_c_int32_t in #(
    17181   no|yes) ;; #(
    17182   *)
    17183 
    17184 cat >>confdefs.h <<_ACEOF
    17185 #define int32_t $ac_cv_c_int32_t
    17186 _ACEOF
    17187 ;;
    17188 esac
    17189 
    17190 ac_fn_c_find_intX_t "$LINENO" "8" "ac_cv_c_int8_t"
    17191 case $ac_cv_c_int8_t in #(
    17192   no|yes) ;; #(
    17193   *)
    17194 
    17195 cat >>confdefs.h <<_ACEOF
    17196 #define int8_t $ac_cv_c_int8_t
    17197 _ACEOF
    17198 ;;
    17199 esac
    17200 
    17201 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C/C++ restrict keyword" >&5
    17202 $as_echo_n "checking for C/C++ restrict keyword... " >&6; }
    17203 if ${ac_cv_c_restrict+:} false; then :
    17204   $as_echo_n "(cached) " >&6
    17205 else
    17206   ac_cv_c_restrict=no
    17207    # The order here caters to the fact that C++ does not require restrict.
    17208    for ac_kw in __restrict __restrict__ _Restrict restrict; do
    17209      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
    17210 /* end confdefs.h.  */
    17211 typedef int * int_ptr;
    17212         int foo (int_ptr $ac_kw ip) {
    17213         return ip[0];
    17214        }
    17215 int
    17216 main ()
    17217 {
    17218 int s[1];
    17219         int * $ac_kw t = s;
    17220         t[0] = 0;
    17221         return foo(t)
    17222   ;
    17223   return 0;
    17224 }
    17225 _ACEOF
    17226 if ac_fn_c_try_compile "$LINENO"; then :
    17227   ac_cv_c_restrict=$ac_kw
    17228 fi
    17229 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
    17230      test "$ac_cv_c_restrict" != no && break
    17231    done
    17232 
    17233 fi
    17234 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_restrict" >&5
    17235 $as_echo "$ac_cv_c_restrict" >&6; }
    17236 
    17237  case $ac_cv_c_restrict in
    17238    restrict) ;;
    17239    no) $as_echo "#define restrict /**/" >>confdefs.h
    17240  ;;
    17241    *)  cat >>confdefs.h <<_ACEOF
    17242 #define restrict $ac_cv_c_restrict
    17243 _ACEOF
    17244  ;;
    17245  esac
    17246 
    17247 ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"
    17248 if test "x$ac_cv_type_size_t" = xyes; then :
    17249 
    17250 else
    17251 
    17252 cat >>confdefs.h <<_ACEOF
    17253 #define size_t unsigned int
    17254 _ACEOF
    17255 
    17256 fi
    17257 
    17258 ac_fn_c_find_uintX_t "$LINENO" "16" "ac_cv_c_uint16_t"
    17259 case $ac_cv_c_uint16_t in #(
    17260   no|yes) ;; #(
    17261   *)
    17262 
    17263 
    17264 cat >>confdefs.h <<_ACEOF
    17265 #define uint16_t $ac_cv_c_uint16_t
    17266 _ACEOF
    17267 ;;
    17268   esac
    17269 
    17270 ac_fn_c_find_uintX_t "$LINENO" "32" "ac_cv_c_uint32_t"
    17271 case $ac_cv_c_uint32_t in #(
    17272   no|yes) ;; #(
    17273   *)
    17274 
    17275 $as_echo "#define _UINT32_T 1" >>confdefs.h
    17276 
    17277 
    17278 cat >>confdefs.h <<_ACEOF
    17279 #define uint32_t $ac_cv_c_uint32_t
    17280 _ACEOF
    17281 ;;
    17282   esac
    17283 
    17284 ac_fn_c_find_uintX_t "$LINENO" "8" "ac_cv_c_uint8_t"
    17285 case $ac_cv_c_uint8_t in #(
    17286   no|yes) ;; #(
    17287   *)
    17288 
    17289 $as_echo "#define _UINT8_T 1" >>confdefs.h
    17290 
    17291 
    17292 cat >>confdefs.h <<_ACEOF
    17293 #define uint8_t $ac_cv_c_uint8_t
    17294 _ACEOF
    17295 ;;
    17296   esac
    17297 
    17298 
    17299 # Checks for library functions.
    17300 for ac_func in memset putenv strchr strtol
    17301 do :
    17302   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
    17303 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
    17304 if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
    17305   cat >>confdefs.h <<_ACEOF
    17306 #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
    17307 _ACEOF
    17308 
    17309 fi
    17310 done
     16717        CFLAGS=$m4cfa_check_save_flags
     16718fi
     16719{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $m4cfa_cv_check_cflags___Wcast_function_type" >&5
     16720$as_echo "$m4cfa_cv_check_cflags___Wcast_function_type" >&6; }
     16721if test "x$m4cfa_cv_check_cflags___Wcast_function_type" = xyes; then :
     16722
     16723$as_echo "#define HAVE_CAST_FUNCTION_TYPE /**/" >>confdefs.h
     16724
     16725else
     16726  :
     16727fi
    1731116728
    1731216729
  • configure.ac

    r9d9a451 r53bb8f1  
    178178AC_PROG_CC
    179179AM_PROG_AS
    180 AM_PROG_CC_C_O  # deprecated
    181180# These are often not installed and people miss seeing the "no", so stop the configure.
    182181AC_PROG_YACC
     
    186185AC_PROG_LIBTOOL
    187186AC_PROG_INSTALL
    188 AC_PROG_MAKE_SET
    189187
    190188# Checks for libraries.
     
    193191
    194192# Checks for header files.
    195 AC_FUNC_ALLOCA
    196 AC_CHECK_HEADERS([fenv.h float.h inttypes.h libintl.h limits.h malloc.h stddef.h stdlib.h string.h unistd.h])
     193AC_CHECK_HEADERS([libintl.h malloc.h unistd.h], [], [echo "Error: Missing required header"; exit 1])
    197194
    198195# Checks for typedefs, structures, and compiler characteristics.
    199 AC_HEADER_STDBOOL
    200 AC_C_INLINE
    201 AC_TYPE_INT16_T
    202 AC_TYPE_INT32_T
    203 AC_TYPE_INT8_T
    204 AC_C_RESTRICT
    205 AC_TYPE_SIZE_T
    206 AC_TYPE_UINT16_T
    207 AC_TYPE_UINT32_T
    208 AC_TYPE_UINT8_T
    209 
    210 # Checks for library functions.
    211 AC_CHECK_FUNCS([memset putenv strchr strtol])
     196AC_CHECK_TYPES([_Float32], AC_DEFINE([HAVE_KEYWORDS_FLOATXX], [], [Have keywords _FloatXX.]), [], [[]])
     197
     198# Checks for compiler flags.
     199M4CFA_CHECK_COMPILE_FLAG([-Wcast-function-type], AC_DEFINE([HAVE_CAST_FUNCTION_TYPE], [], [Have compiler warning cast-function-type.]))
    212200
    213201#==============================================================================
  • doc/LaTeXmacros/lstlang.sty

    r9d9a451 r53bb8f1  
    88%% Created On       : Sat May 13 16:34:42 2017
    99%% Last Modified By : Peter A. Buhr
    10 %% Last Modified On : Fri Apr  6 23:44:50 2018
    11 %% Update Count     : 20
     10%% Last Modified On : Tue Jan  8 14:40:33 2019
     11%% Update Count     : 21
    1212%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1313
     
    114114                _Alignas, _Alignof, __alignof, __alignof__, asm, __asm, __asm__, __attribute, __attribute__,
    115115                auto, _Bool, catch, catchResume, choose, _Complex, __complex, __complex__, __const, __const__,
    116                 coroutine, disable, dtype, enable, __extension__, exception, fallthrough, fallthru, finally,
     116                coroutine, disable, dtype, enable, exception, __extension__, fallthrough, fallthru, finally,
    117117                __float80, float80, __float128, float128, forall, ftype, _Generic, _Imaginary, __imag, __imag__,
    118118                inline, __inline, __inline__, __int128, int128, __label__, monitor, mutex, _Noreturn, one_t, or,
  • doc/bibliography/pl.bib

    r9d9a451 r53bb8f1  
    330330    contributer = {pabuhr@plg},
    331331    author      = {Nissim Francez},
    332     title       = {Another Advantage of Key word Notation for Parameter Communication with Subprograms},
     332    title       = {Another Advantage of Keyword Notation for Parameter Communication with Subprograms},
    333333    journal     = cacm,
    334334    volume      = 20,
     
    831831    year        = 2015,
    832832    howpublished= {\href{http://www.boost.org/doc/libs/1_61_0/libs/coroutine/doc/html/index.html}
    833                   {{http://www.boost.org/\-doc/\-libs/1\_61\_0/\-libs/\-coroutine/\-doc/\-html/\-index.html}}},
    834     optnote     = {Accessed: 2016-09},
     833                  {http://www.boost.org/\-doc/\-libs/1\_61\_0/\-libs/\-coroutine/\-doc/\-html/\-index.html}},
     834}
     835
     836@misc{BoostThreads,
     837    keywords    = {Boost Thread Library},
     838    contributer = {pabuhr@plg},
     839    author      = {Anthony Williams and Vicente J. Botet Escriba},
     840    title       = {Boost Thread Library},
     841    year        = 2015,
     842    howpublished= {\href{https://www.boost.org/doc/libs/1_61_0/doc/html/thread.html}
     843                  {https://\-www.boost.org/\-doc/\-libs/\-1\_61\_0/\-doc/\-html/\-thread.html}},
    835844}
    836845
     
    939948    author      = {{\textsf{C}{$\mathbf{\forall}$} Features}},
    940949    howpublished= {\href{https://plg.uwaterloo.ca/~cforall/features}{https://\-plg.uwaterloo.ca/\-$\sim$cforall/\-features}},
    941     optnote     = {Accessed: 2018-01-01},
    942950}
    943951
     
    959967    year        = 2018,
    960968    howpublished= {\href{https://cforall.uwaterloo.ca/CFAStackEvaluation.zip}{https://cforall.uwaterloo.ca/\-CFAStackEvaluation.zip}},
    961     optnote     = {[Accessed May 2018]},
    962969}
    963970
     
    11341141}
    11351142
    1136 @Inproceedings{Tarditi18,
    1137     keywords = {Checked C},
    1138     contributer = {a3moss@uwaterloo.ca},
    1139     author = {Tarditi, David and Elliott, Archibald Samuel and Ruef, Andrew and Hicks, Michael},
    1140     title = {Checked C: Making C Safe by Extension},
     1143@inproceedings{Tarditi18,
     1144    keywords    = {Checked C},
     1145    contributer = {a3moss@uwaterloo.ca},
     1146    author      = {Tarditi, David and Elliott, Archibald Samuel and Ruef, Andrew and Hicks, Michael},
     1147    title       = {Checked C: Making C Safe by Extension},
     1148    booktitle   = {2018 IEEE Cybersecurity Development (SecDev)}
    11411149    year = {2018},
    11421150    month = {September},
     1151    pages = {53-60},
    11431152    publisher = {IEEE},
    11441153    url = {https://www.microsoft.com/en-us/research/publication/checkedc-making-c-safe-by-extension/},
    1145     pages = {53-60},
    11461154}
    11471155
     
    13141322    journal     = sigplan,
    13151323    year        = 1986,
    1316     month       = oct, volume = 21, number = 10, pages = {19-28},
     1324    month       = oct,
     1325    volume      = 21,
     1326    number      = 10,
     1327    pages       = {19-28},
    13171328    note        = {Object Oriented Programming Workshop}
    13181329}
     
    14791490    title       = {concurrent-locking},
    14801491    howpublished= {\href{https://github.com/pabuhr/concurrent-locking}{https://\-github.com/\-pabuhr/\-concurrent-locking}},
    1481     optnote     = {[Accessed April 2017]},
    14821492}
    14831493
     
    17671777    howpublished= {\href{https://www.airs.com/blog/archives/428}
    17681778                  {https://www.airs.com/\-blog/\-archives/\-428}},
    1769     optnote     = {Accessed: 2018-05},
    17701779}
    17711780
     
    29562965    year        = 2014,
    29572966    howpublished= {\href{https://gcc.gnu.org/onlinedocs/gcc-4.7.2/gcc/C-Extensions.html}{https://\-gcc.gnu.org/\-onlinedocs/\-gcc-4.7.2/\-gcc/\-C\-Extensions.html}},
    2958     optnote     = {Accessed: 2017-04-02},
    29592967}
    29602968
     
    30403048}
    30413049
     3050@manual{WindowsFibers,
     3051    keywords    = {threads, fibers},
     3052    contributer = {pabuhr@plg},
     3053    author      = {Windows},
     3054    title       = {Fibers},
     3055    organization= {Microsoft, Windows Development Center},
     3056    address     = {\href{https://docs.microsoft.com/en-us/windows/desktop/ProcThread/fibers}{https://\-docs.microsoft.com/\-en-us/\-windows/\-desktop/\-ProcThread/\-fibers}},
     3057    year        = 2018,
     3058}
     3059
    30423060@inproceedings{F-bound,
    30433061    keywords    = {},
     
    30873105}
    30883106
     3107@manual{Folly,
     3108    keywords    = {Folly},
     3109    contributer = {pabuhr@plg},
     3110    author      = {Folly},
     3111    title       = {Facebook Open-source Library},
     3112    organization= {Facebook},
     3113    address     = {\href{https://github.com/facebook/folly}{https://\-github.com/\-facebook/\-folly}},
     3114    year        = 2018,
     3115}
     3116
    30893117@manual{Fortran95,
    30903118    keywords    = {Fortran 95},
     
    31073135    address     = {\href{https://www.iso.org/standard/50459.html}{https://\-www.iso.org/\-standard/\-50459.html}},
    31083136    year        = 2010,
     3137}
     3138
     3139@manual{Fortran18,
     3140    keywords    = {ISO/IEC Fortran 10},
     3141    contributer = {pabuhr@plg},
     3142    author      = {Fortran18},
     3143    title       = {Programming Languages -- {Fortran} Part 1:Base Language ISO/IEC 1539-1:2018},
     3144    edition     = {4rd},
     3145    publisher   = {International Standard Organization},
     3146    address     = {\href{https://www.iso.org/standard/72320.html}{https://\-www.iso.org/\-standard/\-72320.html}},
     3147    year        = 2018,
    31093148}
    31103149
     
    33563395    year        = 2014,
    33573396    howpublished= {https://developer.gnome.org/gobject/stable/},
    3358     optnote     = {Accessed: 2017-04},
    33593397}
    33603398
     
    36713709    year        = {1964},
    36723710    publisher   = {ACM}
     3711}
     3712
     3713@phdthesis{Barghi18,
     3714    keywords    = {concurrency, user threads, actors},
     3715    contributer = {pabuhr@plg},
     3716    author      = {Saman Barghi},
     3717    title       = {Improving the Performance of User-level Runtime Systems for Concurrent Applications},
     3718    school      = {School of Computer Science, University of Waterloo},
     3719    year        = 2018,
     3720    month       = sep,
     3721    optaddress  = {Waterloo, Ontario, Canada, N2L 3G1},
     3722    note        = {\href{https://uwspace.uwaterloo.ca/handle/10012/13935}{https://\-uwspace.uwaterloo.ca/\-handle/\-10012/\-13935}},
    36733723}
    36743724
     
    39984048    year        = 2015,
    39994049    edition     = {{J}ava {SE} 8},
     4050}
     4051
     4052@manual{Java11,
     4053    keywords    = {Java SE 11},
     4054    contributer = {pabuhr@plg},
     4055    author      = {James Gosling and Bill Joy and Guy Steele and Gilad Bracha and Alex Buckley and Daniel Smith},
     4056    title       = {{Java} Language Specification},
     4057    publisher   = {Oracle},
     4058    month       = sep,
     4059    year        = 2018,
     4060    edition     = {{J}ava {SE} 11},
     4061}
     4062
     4063@manual{JDK1.1,
     4064    keywords    = {JDK 1.1},
     4065    contributer = {pabuhr@plg},
     4066    author      = {{Multithreading Models}},
     4067    title       = {JDK 1.1 for Solaris Developer's Guide},
     4068    publisher   = {Oracle},
     4069    address     = {\href{https://docs.oracle.com/cd/E19455-01/806-3461/6jck06gqk/index.html#ch2mt-41}{https://\-docs.oracle.com/\-cd/\-E19455-01/\-806-3461/\-6jck06gqk/\-index.html\#ch2mt-41}},
     4070    year        = 2010,
    40004071}
    40014072
     
    41794250}
    41804251
     4252@manual{libmill,
     4253    keywords    = {libmill},
     4254    contributer = {pabuhr@plg},
     4255    author      = {libmill},
     4256    title       = {{G}o-style concurrency in {C}, Version 1.18},
     4257    organization= {libmill},
     4258    address     = {\href{http://libmill.org/documentation.html}{http://\-libmill.org/\-documentation.html}},
     4259    month       = jan,
     4260    year        = 2017,
     4261}
     4262
    41814263@book{Weissman67,
    41824264    keywords    = {lisp},
     
    42244306    pages       = {161-169},
    42254307    note        = {Proceedings of the {SIGPLAN}~'89 Conference on Programming Language Design and Implementation}
     4308}
     4309
     4310@manual{Lua,
     4311    keywords    = {Lua},
     4312    contributer = {pabuhr@plg},
     4313    author      = {Lua},
     4314    title       = {Lua 5.3 Reference Manual},
     4315    address     = {\href{https://www.lua.org/manual/5.3}{https://\-www.lua.org/\-manual/\-5.3}},
     4316    year        = 2018,
    42264317}
    42274318
     
    45664657}
    45674658%    editor     = {Allen Kent and James G. Williams},
     4659
     4660@incollection{MPC,
     4661    keywords    = {user-level threading},
     4662    contributer = {pabuhr@plg},
     4663    author      = {Marc P\'erache and Herv\'e Jourdren and Raymond Namyst},
     4664    title       = {MPC: A Unified Parallel Runtime for Clusters of {NUMA} Machines},
     4665    booktitle   = {Euro-Par 2008},
     4666    pages       = {329-342},
     4667    publisher   = {Springer},
     4668    address     = {Berlin, Heidelberg},
     4669    year        = 2008,
     4670    volume      = 5168,
     4671    series      = {Lecture Notes in Computer Science},
     4672}
    45684673
    45694674@manual{MPI,
     
    49925097    year        = 2014,
    49935098    howpublished= {\href{https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC}{https://\-developer.apple.com/\-library/archive/\-documentation/\-Cocoa/\-Conceptual/\-ProgrammingWithObjectiveC}},
    4994     optnote     = {Accessed: 2018-03}
    49955099}
    49965100
     
    50025106    year        = 2015,
    50035107    howpublished= {\href{https://developer.apple.com/library/content/documentation/Xcode/Conceptual/RN-Xcode-Archive/Chapters/xc7_release_notes.html}{https://\-developer.apple.com/\-library/\-content/\-documentation/\-Xcode/\-Conceptual/\-RN-Xcode-Archive/\-Chapters/\-xc7\_release\_notes.html}},
    5004     optnote     = {Accessed: 2017-04}
    50055108}
    50065109
     
    55155618    year        = 2012,
    55165619    howpublished= {\href{http://cs.brown.edu/research/pubs/theses/masters/2012/verch.pdf}{http://cs.brown.edu/\-research/\-pubs/\-theses/\-masters/\-2012/\-verch.pdf}},
    5517     optnote     = {Accessed: 2013-10-4}
    55185620}
    55195621
     
    58395941    address     = {\href{https://www.iso.org/standard/64029.html}{https://\-www.iso.org/\-standard/\-64029.html}},
    58405942    year        = 2014,
     5943}
     5944
     5945@manual{C++17,
     5946    keywords    = {ISO/IEC C++ 17},
     5947    contributer = {pabuhr@plg},
     5948    key         = {C++17},
     5949    title       = {{C}{\kern-.1em\hbox{\large\texttt{+\kern-.25em+}}} Programming Language ISO/IEC 14882:2017},
     5950    edition     = {5th},
     5951    publisher   = {International Standard Organization},
     5952    address     = {\href{https://www.iso.org/standard/68564.html}{https://\-www.iso.org/\-standard/\-68564.html}},
     5953    year        = 2017,
    58415954}
    58425955
     
    59926105    institution = {Carnegie Mellon University},
    59936106    year        = 1991,
    5994     month       = feb, number = "CMU-CS-91-106",
     6107    month       = feb,
     6108    number      = {CMU-CS-91-106},
    59956109    annote      = {
    59966110        Discusses a typed lambda calculus with
     
    60496163    journal     = sigplan,
    60506164    year        = 1988,
    6051     month       = jul, volume = 23, number = 7, pages = {260-267},
    6052     note        = {Proceedings of the SIGPLAN '88 Conference on Programming Language
    6053          Design and Implementation},
     6165    month       = jul,
     6166    volume      = 23,
     6167    number      = 7,
     6168    pages       = {260-267},
     6169    note        = {Proceedings of the SIGPLAN '88 Conference on Programming Language Design and Implementation},
    60546170    abstract    = {
    60556171        This paper deals with the integration of an efficient asynchronous
     
    61016217}
    61026218
     6219@misc{Pthreads,
     6220    keywords    = {pthreads, C concurrency},
     6221    contributer = {pabuhr@plg},
     6222    key         = {pthreads},
     6223    title       = {{Pthread}.h, Specifications Issue 7, {IEEE} Std 1003.1-2017},
     6224    author      = {IEEE and {The Open Group}},
     6225    year        = 2018,
     6226    howpublished= {\href{http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/pthread.h.html}
     6227                  {http://\-pubs.opengroup.org/\-onlinepubs/\-9699919799/\-basedefs/\-pthread.h.html}},
     6228}
     6229
    61036230@manual{Python,
    61046231    keywords    = {Python},
    61056232    contributer = {pabuhr@plg},
    6106     title       = {Python Reference Manual, Release 2.5},
    6107     author      = {Guido van Rossum},
     6233    author      = {Python},
     6234    title       = {Python Language Reference, Release 3.7.2},
    61086235    organization= {Python Software Foundation},
    6109     month       = sep,
    6110     year        = 2006,
    6111     note        = {Fred L. Drake, Jr., editor},
     6236    address     = {\href{https://docs.python.org/3/reference/index.html}{https://\-docs.python.org/\-3/\-reference/\-index.html}},
     6237    year        = 2018,
    61126238}
    61136239
    61146240% Q
     6241
     6242@inproceedings{Qthreads,
     6243    keywords    = {user-level threading},
     6244    author      = {Kyle B. Wheeler and Richard C. Murphy and Douglas Thain},
     6245    title       = {Qthreads: An API for Programming with Millions of Lightweight Threads},
     6246    booktitle   = {International Symposium on Parallel and Distributed Processing},
     6247    organization= {IEEE},
     6248    address     = {Miami, FL, USA},
     6249    month       = apr,
     6250    year        = 2008,
     6251}
    61156252
    61166253@article{Grossman06,
     
    61496286}
    61506287
     6288@manual{Quasar,
     6289    keywords    = {Quasar},
     6290    contributer = {pabuhr@plg},
     6291    author      = {Quasar},
     6292    title       = {Quasar Documentation, Release 0.8.0},
     6293    organization= {Parallel Universe},
     6294    address     = {\href{http://docs.paralleluniverse.co/quasar}{http://\-docs.paralleluniverse.co/\-quasar}},
     6295    year        = 2018,
     6296}
     6297
    61516298% R
    61526299
     
    62626409    number      = 10,
    62636410    pages       = {27-32},
     6411}
     6412
     6413@article{Hesselink06,
     6414    author      = {Wim H. Hesselink},
     6415    title       = {Refinement Verification of the Lazy Caching Algorithm},
     6416    journal     = acta,
     6417    year        = 2006,
     6418    month       = oct,
     6419    volume      = 43,
     6420    number      = 3,
     6421    pages       = {195--222},
    62646422}
    62656423
     
    64006558}
    64016559
     6560@manual{Ruby,
     6561    keywords    = {Ruby},
     6562    contributer = {pabuhr@plg},
     6563    author      = {Ruby},
     6564    title       = {Ruby Documentation, Release 2.6.0},
     6565    organization= {Python Software Foundation},
     6566    address     = {\href{https://www.ruby-lang.org/en/documentation}{https://\-www.ruby-lang.org/\-en/\-documentation}},
     6567    year        = 2018,
     6568}
     6569
    64026570% S
    64036571
     
    71907358    author      = {{TIOBE Index}},
    71917359    howpublished= {\href{http://www.tiobe.com/tiobe_index}{http://\-www.tiobe.com/\-tiobe\_index}},
    7192     optnote     = {Accessed: 2018-09},
     7360}
     7361
     7362@misc{ThreadModel,
     7363    contributer = {pabuhr@plg},
     7364    key         = {ThreadModel},
     7365    title       = {Thread (computing)},
     7366    author      = {{Threading Model}},
     7367    howpublished= {\href{https://en.wikipedia.org/wiki/Thread_(computing)}{https://\-en.wikipedia.org/\-wiki/\-Thread\_(computing)}},
    71937368}
    71947369
     
    75227697    year        = 2017,
    75237698    howpublished= {\url{https://wiki.gnome.org/Projects/Vala/Manual}},
    7524     optnote     = {Accessed: 2017-04}
    75257699}
    75267700
     
    76967870% Y
    76977871
     7872@article{Boehm12,
     7873    keywords    = {memory model, race condition},
     7874    contributer = {pabuhr@plg},
     7875    author      = {Boehm, Hans-J. and Adve, Sarita V.},
     7876    title       = {You Don'T Know Jack About Shared Variables or Memory Models},
     7877    journal     = cacm,
     7878    volume      = 55,
     7879    number      = 2,
     7880    month       = feb,
     7881    year        = 2012,
     7882    pages       = {48--54},
     7883    publisher   = {ACM},
     7884    address     = {New York, NY, USA},
     7885}
     7886
    76987887% Z
    76997888
  • doc/papers/concurrency/Paper.tex

    r9d9a451 r53bb8f1  
    228228}
    229229
    230 \title{\texorpdfstring{Concurrency in \protect\CFA}{Concurrency in Cforall}}
     230\title{\texorpdfstring{Advanced Control-flow in \protect\CFA}{Advanced Control-flow in Cforall}}
    231231
    232232\author[1]{Thierry Delisle}
     
    241241
    242242\abstract[Summary]{
    243 \CFA is a modern, polymorphic, \emph{non-object-oriented} extension of the C programming language.
    244 This paper discusses the design of the concurrency and parallelism features in \CFA, and its concurrent runtime-system.
    245 These features are created from scratch as ISO C lacks concurrency, relying largely on the pthreads library for concurrency.
    246 Coroutines and lightweight (user) threads are introduced into \CFA;
    247 as well, monitors are added as a high-level mechanism for mutual exclusion and synchronization.
    248 A unique contribution of this work is allowing multiple monitors to be safely acquired \emph{simultaneously}.
     243\CFA is a modern, polymorphic, non-object-oriented, backwards-compatible extension of the C programming language.
     244This paper discusses the advanced control-flow features in \CFA, which include concurrency and parallelism, and its supporting runtime system.
     245These features are created from scratch as ISO C's concurrency is low-level and unimplemented, so C programmers continue to rely on the C pthreads library.
     246\CFA provides high-level control-flow mechanisms, like coroutines and user-level threads, and monitors for mutual exclusion and synchronization.
     247A unique contribution of this work is allowing multiple monitors to be safely acquired \emph{simultaneously} (deadlock free), while integrating this capability with all monitor synchronization mechanisms.
    249248All features respect the expectations of C programmers, while being fully integrate with the \CFA polymorphic type-system and other language features.
    250249Experimental results show comparable performance of the new features with similar mechanisms in other concurrent programming-languages.
    251250}%
    252251
    253 \keywords{concurrency, parallelism, coroutines, threads, monitors, runtime, C, Cforall}
     252\keywords{coroutines, concurrency, parallelism, threads, monitors, runtime, C, \CFA (Cforall)}
    254253
    255254
     
    262261\section{Introduction}
    263262
     263This paper discusses the design of advanced, high-level control-flow extensions (especially concurrency and parallelism) in \CFA and its runtime.
     264\CFA is a modern, polymorphic, non-object-oriented\footnote{
     265\CFA has features often associated with object-oriented programming languages, such as constructors, destructors, virtuals and simple inheritance.
     266However, functions \emph{cannot} be nested in structures, so there is no lexical binding between a structure and set of functions (member/method) implemented by an implicit \lstinline@this@ (receiver) parameter.},
     267backwards-compatible extension of the C programming language~\cite{Moss18}.
     268Within the \CFA framework, new control-flow features were created from scratch.
     269ISO \Celeven defines only a subset of the \CFA extensions, and with respect to concurrency~\cite[\S~7.26]{C11}, the features are largely wrappers for a subset of the pthreads library~\cite{Butenhof97,Pthreads}.
     270Furthermore, \Celeven and pthreads concurrency is basic, based on thread fork/join in a function and a few locks, which is low-level and error prone;
     271no high-level language concurrency features exist.
     272Interestingly, almost a decade after publication of the \Celeven standard, neither gcc-8, clang-8 nor msvc-19 (most recent versions) support the \Celeven include @threads.h@, indicating little interest in the C concurrency approach.
     273Finally, while the \Celeven standard does not state a concurrent threading-model, the historical association with pthreads suggests the threading model is kernel-level threading (1:1)~\cite{ThreadModel}.
     274
     275In contrast, there has been a renewed interest during the past decade in user-level (M:N, green) threading in old and new programming languages.
     276As multi-core hardware became available in the 1980/90s, both user and kernel threading were examined.
     277Kernel threading was chosen, largely because of its simplicity and fit with the simpler operating systems and hardware architectures at the time, which gave it a performance advantage~\cite{Drepper03}.
     278Libraries like pthreads were developed for C, and the Solaris operating-system switched from user (JDK 1.1~\cite{JDK1.1}) to kernel threads.
     279As a result, languages like Java, Scala~\cite{Scala}, Objective-C~\cite{obj-c-book}, \CCeleven~\cite{C11}, and C\#~\cite{Csharp} adopted the 1:1 kernel-threading model, with a variety of presentation mechanisms.
     280From 2000 onwards, languages like Go~\cite{Go}, Erlang~\cite{Erlang}, Haskell~\cite{Haskell}, D~\cite{D}, and \uC~\cite{uC++,uC++book} have championed the M:N user-threading model, and many user-threading libraries have appeared~\cite{Qthreads,MPC,BoostThreads}, including putting green threads back into Java~\cite{Quasar}.
     281The main argument for user-level threading is that they are lighter weight than kernel threads (locking and context switching do not cross the kernel boundary), so there is less restriction on programming styles that encourage large numbers of threads performing smaller work-units to facilitate load balancing by the runtime~\cite{Verch12}.
     282As well, user-threading facilitates a simpler concurrency approach using thread objects that leverage sequential patterns versus events with call-backs~\cite{vonBehren03}.
     283Finally, performant user-threading implementations (both time and space) are largely competitive with direct kernel-threading implementations, while achieving the programming advantages of high concurrency levels and safety.
     284
     285A further effort over the past decade is the development of language memory-models to deal with the conflict between certain language features and compiler/hardware optimizations.
     286This issue can be rephrased as some features are pervasive (language and runtime) and cannot be safely added via a library to prevent invalidation by sequential optimizations~\cite{Buhr95a,Boehm05}.
     287The consequence is that a language must be cognizant of these features and provide sufficient tools to program around any safety issues.
     288For example, C created the @volatile@ qualifier to provide correct execution for @setjmp@/@logjmp@ (concurrency came later).
     289The simplest solution is to provide a handful of complex qualifiers and functions (e.g., @volatile@ and atomics) allowing programmers to write consistent/race-free programs, often in the sequentially-consistent memory-model~\cite{Boehm12}.
     290
     291While having a sufficient memory-model allows sound libraries to be constructed, writing these libraries can quickly become awkward and error prone, and using these low-level libraries has the same issues.
     292Essentially, using low-level explicit locks is the concurrent equivalent of assembler programming.
     293Just as most assembler programming is replaced with programming in a high-level language, explicit locks can be replaced with high-level concurrency constructs in a programming language.
     294The goal is to get the compiler to check for correct usage and follow any complex coding conventions implicitly.
     295The drawback is that language constructs may preclude certain specialized techniques, therefore introducing inefficiency or inhibiting concurrency.
     296For most concurrent programs, these drawbacks are insignificant in comparison to the speed of composition, and subsequent reliability and maintainability of the high-level concurrent program.
     297(The same is true for high-level programming versus assembler programming.)
     298Only very rarely should it be necessary to drop down to races and/or explicit locks to apply a specialized technique to achieve maximum speed or concurrency.
     299As stated, this observation applies to non-concurrent forms of complex control-flow, like exception handling and coroutines.
     300
     301Adapting the programming language allows matching the control-flow model with the programming-language style, versus adapting to one general (sound) library/paradigm.
     302For example, it is possible to provide exceptions, coroutines, monitors, and tasks as specialized types in an object-oriented language, integrating these constructs to allow leveraging the type-system (static type-checking) and all other object-oriented capabilities~\cite{uC++}.
     303It is also possible to leverage call/return for blocking communication via new control structures, versus switching to alternative communication paradigms, like channels or message passing.
     304As well, user threading is often a complementary feature, allowing light-weight threading to match with low-cost objects, while hiding the application/kernel boundary.
     305User threading also allows layering of implicit concurrency models (no explicit thread creation), such executors, data-flow, actors, into a single language, so programmers can chose the model that best fits an algorithm.\footnote{
     306All implicit concurrency models have explicit threading in their implementation, and hence, can be build from explicit threading;
     307however, the reverse is seldom true, i.e., given implicit concurrency, e.g., actors, it is virtually impossible to create explicit concurrency, e.g., blocking thread objects.}
     308Finally, with extended language features and user-level threading it is possible to discretely fold locking and non-blocking I/O multiplexing into the language's I/O libraries, so threading implicitly dovetails with the I/O subsystem.
     309
     310\CFA embraces language extensions and user-level threading to provide advanced control-flow and concurrency.
     311We attempt to show the \CFA extensions and runtime are demonstrably better than those proposed for \CC and other concurrent, imperative programming languages.
     312The contributions of this work are:
     313\begin{itemize}
     314\item
     315allowing multiple monitors to be safely acquired \emph{simultaneously} (deadlock free), while seamlessly integrating this capability with all monitor synchronization mechanisms.
     316\item
     317all control-flow features respect the expectations of C programmers, with statically type-safe interfaces that integrate with the \CFA polymorphic type-system and other language features.
     318\item
     319experimental results show comparable performance of the new features with similar mechanisms in other concurrent programming-languages.
     320\end{itemize}
     321
     322\begin{comment}
    264323This paper provides a minimal concurrency \newterm{Application Program Interface} (API) that is simple, efficient and can be used to build other concurrency features.
    265324While the simplest concurrency system is a thread and a lock, this low-level approach is hard to master.
     
    281340The proposed concurrency API is implemented in a dialect of C, called \CFA (pronounced C-for-all).
    282341The paper discusses how the language features are added to the \CFA translator with respect to parsing, semantics, and type checking, and the corresponding high-performance runtime-library to implement the concurrent features.
    283 
    284 
     342\end{comment}
     343
     344
     345\begin{comment}
    285346\section{\CFA Overview}
    286347
     
    551612\end{cfa}
    552613where the return type supplies the type/size of the allocation, which is impossible in most type systems.
    553 
    554 
    555 \section{Concurrency}
    556 \label{s:Concurrency}
    557 
    558 At its core, concurrency is based on multiple call-stacks and scheduling threads executing on these stacks.
    559 Multiple call stacks (or contexts) and a single thread of execution, called \newterm{coroutining}~\cite{Conway63,Marlin80}, does \emph{not} imply concurrency~\cite[\S~2]{Buhr05a}.
    560 In coroutining, the single thread is self-scheduling across the stacks, so execution is deterministic, \ie the execution path from input to output is fixed and predictable.
    561 A \newterm{stackless} coroutine executes on the caller's stack~\cite{Python} but this approach is restrictive, \eg preventing modularization and supporting only iterator/generator-style programming;
    562 a \newterm{stackful} coroutine executes on its own stack, allowing full generality.
    563 Only stackful coroutines are a stepping stone to concurrency.
    564 
    565 The transition to concurrency, even for execution with a single thread and multiple stacks, occurs when coroutines also context switch to a \newterm{scheduling oracle}, introducing non-determinism from the coroutine perspective~\cite[\S~3]{Buhr05a}.
    566 Therefore, a minimal concurrency system is possible using coroutines (see Section \ref{coroutine}) in conjunction with a scheduler to decide where to context switch next.
    567 The resulting execution system now follows a cooperative threading-model, called \newterm{non-preemptive scheduling}.
    568 
    569 Because the scheduler is special, it can either be a stackless or stackful coroutine.
    570 For stackless, the scheduler performs scheduling on the stack of the current coroutine and switches directly to the next coroutine, so there is one context switch.
    571 For stackful, the current coroutine switches to the scheduler, which performs scheduling, and it then switches to the next coroutine, so there are two context switches.
    572 A stackful scheduler is often used for simplicity and security.
    573 
    574 Regardless of the approach used, a subset of concurrency related challenges start to appear.
    575 For the complete set of concurrency challenges to occur, the missing feature is \newterm{preemption}, where context switching occurs randomly between any two instructions, often based on a timer interrupt, called \newterm{preemptive scheduling}.
    576 While a scheduler introduces uncertainty in the order of execution, preemption introduces uncertainty about where context switches occur.
    577 Interestingly, uncertainty is necessary for the runtime (operating) system to give the illusion of parallelism on a single processor and increase performance on multiple processors.
    578 The reason is that only the runtime has complete knowledge about resources and how to best utilized them.
    579 However, the introduction of unrestricted non-determinism results in the need for \newterm{mutual exclusion} and \newterm{synchronization} to restrict non-determinism for correctness;
    580 otherwise, it is impossible to write meaningful programs.
    581 Optimal performance in concurrent applications is often obtained by having as much non-determinism as correctness allows.
    582 
    583 An important missing feature in C is threading\footnote{While the C11 standard defines a \protect\lstinline@threads.h@ header, it is minimal and defined as optional.
    584 As such, library support for threading is far from widespread.
    585 At the time of writing the paper, neither \protect\lstinline@gcc@ nor \protect\lstinline@clang@ support \protect\lstinline@threads.h@ in their standard libraries.}.
    586 In modern programming languages, a lack of threading is unacceptable~\cite{Sutter05, Sutter05b}, and therefore existing and new programming languages must have tools for writing efficient concurrent programs to take advantage of parallelism.
    587 As an extension of C, \CFA needs to express these concepts in a way that is as natural as possible to programmers familiar with imperative languages.
    588 Furthermore, because C is a system-level language, programmers expect to choose precisely which features they need and which cost they are willing to pay.
    589 Hence, concurrent programs should be written using high-level mechanisms, and only step down to lower-level mechanisms when performance bottlenecks are encountered.
    590 
    591 
    592 \subsection{Coroutines: A Stepping Stone}\label{coroutine}
    593 
    594 While the focus of this discussion is concurrency and parallelism, it is important to address coroutines, which are a significant building block of a concurrency system (but not concurrent among themselves).
     614\end{comment}
     615
     616
     617\section{Coroutines: A Stepping Stone}\label{coroutine}
     618
     619Advanced controlWhile the focus of this discussion is concurrency and parallelism, it is important to address coroutines, which are a significant building block of a concurrency system (but not concurrent among themselves).
    595620Coroutines are generalized routines allowing execution to be temporarily suspended and later resumed.
    596621Hence, unlike a normal routine, a coroutine may not terminate when it returns to its caller, allowing it to be restarted with the values and execution location present at the point of suspension.
     
    10601085\end{cquote}
    10611086The combination of these two approaches allows an easy and concise specification to coroutining (and concurrency) for normal users, while more advanced users have tighter control on memory layout and initialization.
     1087
     1088
     1089\section{Concurrency}
     1090\label{s:Concurrency}
     1091
     1092At its core, concurrency is based on multiple call-stacks and scheduling threads executing on these stacks.
     1093Multiple call stacks (or contexts) and a single thread of execution, called \newterm{coroutining}~\cite{Conway63,Marlin80}, does \emph{not} imply concurrency~\cite[\S~2]{Buhr05a}.
     1094In coroutining, the single thread is self-scheduling across the stacks, so execution is deterministic, \ie the execution path from input to output is fixed and predictable.
     1095A \newterm{stackless} coroutine executes on the caller's stack~\cite{Python} but this approach is restrictive, \eg preventing modularization and supporting only iterator/generator-style programming;
     1096a \newterm{stackful} coroutine executes on its own stack, allowing full generality.
     1097Only stackful coroutines are a stepping stone to concurrency.
     1098
     1099The transition to concurrency, even for execution with a single thread and multiple stacks, occurs when coroutines also context switch to a \newterm{scheduling oracle}, introducing non-determinism from the coroutine perspective~\cite[\S~3]{Buhr05a}.
     1100Therefore, a minimal concurrency system is possible using coroutines (see Section \ref{coroutine}) in conjunction with a scheduler to decide where to context switch next.
     1101The resulting execution system now follows a cooperative threading-model, called \newterm{non-preemptive scheduling}.
     1102
     1103Because the scheduler is special, it can either be a stackless or stackful coroutine.
     1104For stackless, the scheduler performs scheduling on the stack of the current coroutine and switches directly to the next coroutine, so there is one context switch.
     1105For stackful, the current coroutine switches to the scheduler, which performs scheduling, and it then switches to the next coroutine, so there are two context switches.
     1106A stackful scheduler is often used for simplicity and security.
     1107
     1108Regardless of the approach used, a subset of concurrency related challenges start to appear.
     1109For the complete set of concurrency challenges to occur, the missing feature is \newterm{preemption}, where context switching occurs randomly between any two instructions, often based on a timer interrupt, called \newterm{preemptive scheduling}.
     1110While a scheduler introduces uncertainty in the order of execution, preemption introduces uncertainty about where context switches occur.
     1111Interestingly, uncertainty is necessary for the runtime (operating) system to give the illusion of parallelism on a single processor and increase performance on multiple processors.
     1112The reason is that only the runtime has complete knowledge about resources and how to best utilized them.
     1113However, the introduction of unrestricted non-determinism results in the need for \newterm{mutual exclusion} and \newterm{synchronization} to restrict non-determinism for correctness;
     1114otherwise, it is impossible to write meaningful programs.
     1115Optimal performance in concurrent applications is often obtained by having as much non-determinism as correctness allows.
     1116
     1117An important missing feature in C is threading\footnote{While the C11 standard defines a \protect\lstinline@threads.h@ header, it is minimal and defined as optional.
     1118As such, library support for threading is far from widespread.
     1119At the time of writing the paper, neither \protect\lstinline@gcc@ nor \protect\lstinline@clang@ support \protect\lstinline@threads.h@ in their standard libraries.}.
     1120In modern programming languages, a lack of threading is unacceptable~\cite{Sutter05, Sutter05b}, and therefore existing and new programming languages must have tools for writing efficient concurrent programs to take advantage of parallelism.
     1121As an extension of C, \CFA needs to express these concepts in a way that is as natural as possible to programmers familiar with imperative languages.
     1122Furthermore, because C is a system-level language, programmers expect to choose precisely which features they need and which cost they are willing to pay.
     1123Hence, concurrent programs should be written using high-level mechanisms, and only step down to lower-level mechanisms when performance bottlenecks are encountered.
    10621124
    10631125
  • doc/papers/concurrency/mail

    r9d9a451 r53bb8f1  
    2727
    2828Software: Practice and Experience Editorial Office
     29
     30
     31
     32Date: Wed, 3 Oct 2018 21:25:28 +0000
     33From: Richard Jones <onbehalfof@manuscriptcentral.com>
     34Reply-To: R.E.Jones@kent.ac.uk
     35To: tdelisle@uwaterloo.ca, pabuhr@uwaterloo.ca
     36Subject: Software: Practice and Experience - Decision on Manuscript ID
     37 SPE-18-0205
     38
     3903-Oct-2018
     40
     41Dear Dr Buhr,
     42
     43Many thanks for submitting SPE-18-0205 entitled "Concurrency in C∀" to Software: Practice and Experience.
     44
     45In view of the comments of the referees found at the bottom of this letter, I cannot accept your paper for publication in Software: Practice and Experience. I hope that you find the referees' very detailed comments helpful.
     46
     47Thank you for considering Software: Practice and Experience for the publication of your research.  I hope the outcome of this specific submission will not discourage you from submitting future manuscripts.
     48
     49Yours sincerely,
     50
     51
     52Prof. Richard Jones
     53Editor, Software: Practice and Experience
     54R.E.Jones@kent.ac.uk
     55
     56Referee(s)' Comments to Author:
     57
     58Reviewing: 1
     59
     60Comments to the Author
     61"Concurrency in Cforall" presents a design and implementation of a set of standard concurrency features, including coroutines, user-space and kernel-space threads, mutexes, monitors, and a scheduler, for a polymorphic derivation of C called Cforall.
     62
     63Section 2 is an overview of sequential Cforall that does not materially contribute to the paper. A brief syntax explanation where necessary in examples would be plenty.
     64
     65Section 3 begins with with an extensive discussion of concurrency that also does not materially contribute to the paper. A brief mention of whether a particular approach implements cooperative or preemptive scheduling would be sufficient. Section 3 also makes some unfortunate claims, such as C not having threads -- C does in fact define threads, and this is noted as being true in a footnote, immediately after claiming that it does not. The question remains why the C11 parallelism design is insufficient and in what way this paper proposes to augment it. While I am personally a proponent of parallel programming languages, backing the assertion that all modern languages must have threading with citations from 2005 ignores the massive popularity of modern non-parallel languages (Javascript, node.js, Typescript, Python, Ruby, etc.) and parallel languages that are not thread based, although the authors are clearly aware of such approaches.
     66
     67Sections 3.1 and 3.2 dicusses assymetric and symmetric coroutines. This also does not seem to materially contribute to a paper that is ostensibly about concurrency in a modern systems programming language. The area of coroutines, continuations, and generators is already well explored in the context of systems languages, including compilation techniques for these constructs that are more advanced than the stack instantiation model discussed in the paper.
     68
     69Section 3.3 describes threads in Cforall, briefly touching on user-space vs. kernel-space thread implementations without detailing the extensive practical differences. It is unclear how the described interface differes from C++11 threads, as the description seems to center on an RAII style approach to joining in the destructor.
     70
     71Section 4 briefly touches on a collection of well known synchronisation primitives. Again, this discussion does not materially contribute to the paper.
     72
     73Section 5 describes monitors, which are a well known and well researched technique. The Cforall implementation is unsurprising. The "multi-acquire semantics" described are not a contribution of this paper, as establishing a stable order for lock acquisition is a well known technique, one example of which is the C++ std::scoped_lock.
     74
     75Section 6 is a discussion of scheduling that does not appear to be informed by the literature. There is no discussion of work-stealing vs. work-scheduling, static vs. dynamic priorities, priority inversion, or fairness. There is a claim in secion 6.1 for a novel technique, partial signalling, that appears to be a form of dynamic priority, but no comparison is made. In section 6.6, a very brief mention of other synchronisation techniques is made, without reference to current techniques such as array-based locks, CLH or MCS queue locks, RCU and other epoch-based mechanisms, etc. Perhaps these are considered out of scope.
     76
     77Section 7 discusses parallelism, but does not materially contribute to the paper. It is claimed that preemption is necessary to implement spinning, which is not correct, since two cores can implement a spinning based approach without preemption. It is claimed that with thread pools "concurrency errors return", but no approach to removing concurrency errors with either preemptive or cooperatively scheduled user threads has been proposed in the paper that would not also apply to thread pools.
     78
     79Section 8 is intended to describe the Cforall runtime structure, but does so in a way that uses terminology in an unfamiliar way. The word cluster is more usually used in distributed systems, but here refers to a process. The term virtual processor is more usually used in hardware virtualisation, but here refers to a kernel thread. The term debug kernel is more usually used in operating systems to refer to kernels that have both debug info and a method for using a debugger in kernel space, but here refers to a debug build of a user-space process. This section does not materially contribute to the paper.
     80
     81Section 9 is intended to describe the Cforall runtime implementation. It makes some unusual claims, such as C libraries migrating to stack chaining (stack chaining was an experimental GCC feature that has been abandoned, much as it has been abandoned in both Go and Rust).
     82
     83The performance measurements in section 10 are difficult to evaluate. While I appreciate that comparable concurrency benchmarks are very difficult to write, and the corpus of existing benchmarks primarily boils down to the parallel programs in the Computer Language Benchmark Game, the lack of detail as to what is being measured in these benchmarks (particularly when implemented in other languages) is unfortunate. For example, in table 3, the benchmark appears to measure uncontended lock access, which is not a useful micro-benchmark.
     84
     85It is not clear what the contributions of this paper are intended to be. A concise listing of the intended contributions would be helpful. Currently, it appears that the paper makes neither PL contributions in terms of novel features in Cforall, nor does it make systems contributions in terms of novel features in the runtime.
     86
     87
     88Reviewing: 2
     89
     90Comments to the Author
     91This article presents the design and rationale behind the concurrency
     92features of C-forall, a new low-level programming language.  After an
     93introduction that defines a selection of standard terminology, section
     942 gives crucial background on the design of the C-forall language.
     95Section 3 then starts the core of the article, discussing the
     96language's support for "concurrency" which in this case means
     97coroutines and threads; a very brief Section 4 builds on section 3
     98with a discussion of lower level synchronizations.  Section 5 the
     99presents the main features of concurrency control in C-forall:
     100monitors and mutexes. Section 6 then extends monitors with condition
     101variables to to support scheduling, and a very brief section 7
     102discusses preemption and pooling. Section 8 discusses the runtime
     103conceptual model, section 9 gives implementation detail, and section
     10410 briefly evaluates C-forall's performance via five concurrent
     105micro benchmarks. Finally section 11 concludes the article, and then
     106section 12 presents some future work. 
     107
     108
     109At the start of section 7, article lays out its rationale: that while
     110"historically, computer performance was about processor speeds" but
     111"Now, high-performance applications must care about parallelism,
     112which requires concurrency". The doomsayers trumpeting the death of
     113Moore's law have been proved correct at last, with CPUs sequential
     114performance increasing much more slowly than the number of cores
     115within each die. This means programmers --- especially low-level,
     116systems programmers --- must somehow manage the essential complexity
     117of writing concurrent programs to run in parallel in multiple threads
     118across multiple cores. Unfortunately, the most venerable widely used
     119systems programming language, C, supports parallelism only via an
     120e.g. the threads library.  This article aims to integrate concurrent
     121programming mechanisms more closely into a novel low-level C-based
     122programming language, C-forall. The article gives an outline of much of
     123C-forall, presents a series of concurrency mechanisms, and finally
     124some microbenchmark results.  The article is detailed, comprehensive,
     125and generally well written in understandable English.
     126
     127My main concern about the article are indicated by the fact that the
     128best summary of the problem the design of concurrent C-forall sets
     129out to solve is buried more than halfway through the article in section
     1307, as above, and then the best overview of the proposed solution is
     131given in the 2nd, 4th and 5th sentence of the conclusion:
     132
     133   "The approach provides concurrency based on a preemptive M:N
     134    user-level threading-system, executing in clusters, which
     135    encapsulate scheduling of work on multiple kernel threads
     136    providing parallelism... High-level objects (monitor/task) are the
     137    core mechanism for mutual exclusion and synchronization. A novel
     138    aspect is allowing multiple mutex-objects to be accessed
     139    simultaneously reducing the potential for deadlock for this
     140    complex scenario."
     141
     142That is, in my reading of the article, it proceeds bottom up rather
     143than top down, and so my main recommendation is to essentially reverse
     144the order of the article, proceeding from the problem to be solved,
     145the high level architecture of the proposed solutions, and then going
     146down to the low-level mechanisms.  My biggest problem reading the
     147article was for explanations of why a particular decision was taken,
     148or why a particular mechanism may be used --- often this description
     149is actually later in the article, but at that point it's too late for
     150the reader.  I have tried to point out most of these places in the
     151detailed comments below.
     152
     153My second concern is that the article makes several claims that are
     154not really justified by the design or implementation in the article.
     155These include claims that this approach meets the expectations of C
     156programmers, is minimal, is implemented in itself, etc.  The article
     157doesn't generally offer evidence to support these assertions (for many
     158of them, that would require empirical studies of programmers, or at
     159least corpus studies). The solution here is to talk about motivations
     160for the design choices "we made these decisions hoping that C
     161programmers would be comfortable" rather than claims of fact "C
     162programmers are comfortable".  Again I attempt to point these out below.
     163
     164* abstract: needs to characterize the work top down, and not make
     165  claims "features respect the expectations of C programmers" that
     166  are not supported empirically.
     167
     168* p1 line 14 "integrated"
     169
     170* introduction needs to introduce the big ideas and scope of the
     171  article, not define terms.  Some of the terms / distinctions are
     172  non-standard (e.g. the distinction between "concurrency" and
     173  "parallelism") and can be avoided by using more specific terms
     174  (mutual exclusion, synchronization, parallel execution. etc).
     175
     176* to me this article introduces novel language features, not just an
     177  API.  Similarly, it doesn't talk about any additions "to the
     178  language translator" - i.e compiler changes! - rather about language
     179  features.
     180
     181
     182* section 2 lines 6-9 why buy this fight against object-orientation?
     183  this article doesn't need to make this argument, but needs to do a
     184  better job of it if it does (see other comments below)
     185
     186* sec 2.1 - are these the same as C++. IF so, say so, if not, say why
     187  not.
     188
     189* 2.2 calling it a "with statement" was confusing, given that a with
     190  clause can appear in a routine declaration with a shorthand syntax.
     191
     192* 2.3 again compare with C++ and Java (as well as Ada)
     193
     194* line 9 "as we will see in section 3"
     195
     196* 2.4 I really quite like this syntax for operators, destructors not
     197  so much.
     198
     199* 2.5 and many places elsewhere. Always first describe the semantics
     200  of your language constructs, then describe their properties, then
     201  compare with e.g. related languages (mostly C++ & Java?).  E.g in
     202  this case, something like:
     203
     204  "C-forall includes constructors, which are called to initialize
     205  newly allocated objects, and constructors, which are called when
     206  objects are deallocated. Constructors and destructors are written as
     207  functions returning void, under the special names "?{}" for
     208  constructors and "^{}" for destructors: constructors may be
     209  overridden, but destructors may not be.  The semantics of C-forall's
     210  constructors and destructors are essentially those of C++."
     211
     212  this problem repeats many times throughout the article and should be
     213  fixed everywhere.
     214
     215
     216* 2.6 again, first describe then properties then comparison.
     217   in this case, compare e.g. with C++ templates, Java/Ada generics
     218   etc.
     219
     220* why special case forward declarations? It's not 1970 any more.
     221
     222* what are traits?  structural interfaces (like Go interfaces) or
     223  nominal bindings?
     224
     225* section 3 - lines 2-30, also making very specific global definitions
     226  as in the introduction. The article does not need to take on this
     227  fight either, rather make clear that this is the conceptual model in
     228  C-forall. (If the article starts at the top and works down, that may
     229  well follow anyway).
     230
     231* "in modern programming languages... unacceptable"; "in a
     232  system-level language.. concurrent programs should be written with
     233  high-level features" - again, no need to take on these fights.
     234
     235* 3.1 onwards; I found all this "building" up hard to follow.
     236  also it's not clear a "minimal" API must separately support
     237  coroutines, threads, fibres, etc
     238
     239* FIG 2B - where's the output?
     240  syntax "sout | next(f1) | next(f2) | endl" nowhere explained
     241    why not use C++s' << and >>
     242
     243* FIG 3 be clearer, earlier about the coroutine" constructor syntax
     244
     245** ensure all figures are placed *after* their first mention in the
     246   text. consider interleaving smaller snippets of text rather than
     247   just referring to large figures
     248
     249* sec 3.1 p7 etc,. need more context / comparison e.g. Python
     250  generators etc.
     251
     252* FIGURE 4 is this right?  should there a constructor for Cons taking
     253  a Prod?
     254
     255
     256* sec 3.2 order of constructors depends on the language.  more
     257  generally, if the article is going to make arguments against OO
     258  (e.g. section 2) then the article needs to explain, in detail, why
     259  e.g. coroutine, thread, etc *cannot* be classes / objects.
     260
     261* "type coroutine_t must be an abstract handle.. descriptor and is
     262  stack are non-copyable" - too many assumptions in here (and other
     263  similar passages) that are not really spelled out in detail.
     264
     265* p10 line 4 introduces "coroutine" keyword. needs to give its
     266  semantics. also needs to introduce and define properties and compare
     267  before all the examples using coroutines.
     268
     269* p10 again, trait semantics need to be better defined
     270
     271* 3.3 should be an introduction to this section. Note that section
     272  titles are not part of the text of the article.
     273
     274* what's the difference between "coroutines" and "user threads" (and
     275  "fibres?")
     276
     277* what's a "task type" or an "interface routine"  or "underlying
     278  thread"
     279
     280* section 4 - "... meaningless". nope some semantics are possible
     281  e.g. if there's a memory model.
     282
     283* whatare "call/return based languages"
     284
     285* p12 - what if a programmer wants to join e.g. "1st of N" or "1st 3 of N"
     286  threads rather than all threads in order
     287
     288* 4.1 p12 13-25, again it's not clear where this is going.  presenting the model
     289  top down may hopefully resolve this
     290
     291* section 4 should be merged e.g. into sec 3 (or 5)
     292
     293
     294
     295* section 5 p13 what's "routine" scope. "call/return paradigm"
     296
     297* thread/ coroutine declarations, traits etc, all look pretty close to
     298  inheritance. why wouldn't inheritance work?
     299
     300* open/closed locks = free/acquired free locks?
     301
     302* testability?
     303
     304* p14 lines 14-20 I had trouble following this.  e.g/. what's the
     305  difference between "a type that is a monitor" and "a type that looks
     306  like a monitor"?  why?
     307
     308* line 39 - what's an "object-oriented monitor"?    Java?
     309    there is no one OO model of such things.
     310
     311* line 47 significant asset - how do you know?
     312
     313* how could this e.g. build a reader/writer lock
     314
     315* *p15 what's the "bank account transfer problem"
     316
     317*p16 lines6-10  why? explain?
     318
     319*p17 semantics of arrays of conditions is unclear
     320     given e.g. previous comments about arrays of mutexes.
     321
     322*p18 define "spurious wakeup"
     323
     324*p18 line 44 - "a number of approaches were examined"?  which
     325 approaches? examined by whom?  if this is a novel contribution, needs
     326 rather more there, and more comparison with related work
     327
     328* FIG 8 consider e.g. sequence diagrams rather than code to show these
     329  cases
     330
     331* 6.2 p19 line 5 "similarly, monitor routines can be added at any
     332  time" really?  I thought C-forall was compiled? there's a big
     333  difference between "static" and "dynamic" inheritance. which is this
     334  closer to?
     335
     336* line 25 "FIgure 9 (B) shows the monitor implementation"
     337   I didn't understand this, especially not as an implementation.
     338
     339* section 6.6 - if the article is to make claims about completeness,
     340  about supporting low and high level operations, then this must be
     341  expanded to give enough detail to support that argument
     342
     343* "truest realization" huh?
     344
     345* section 7 should be merged into 6 or 8.
     346  it's not clear if this is exploring rejected alternatives,
     347  out outlining different features offered by C-forall, or what.
     348
     349
     350* sec 7.2 how do the other threads in sections 5 & 6 relate to the
     351  user threads, fibres, etc here;
     352
     353* sec 8.1 I found these sections hard to follow. how is a cluster a
     354  "collection of threads and virtual processors... like a virtual
     355  machine"? Where do the thread pools from 7.3 fit in?
     356
     357*  sec 8.3 is out of place, probably unneeded in the paper
     358
     359* section 9 dives straight into details with no overview.  Section 9
     360  seems very detailed, and depends on assumptions or details that are
     361  not in the article.
     362
     363* section 10 covers only microbenchmarks. are there any moderate sized
     364  macrobenchmarks that can compare across the different systems?
     365  (e.g the Erlang Ring?)
     366
     367* sec 11 claims that "the entire C-forall runtime system are written
     368  in C-forall". The article doesn't
     369
     370
     371* future work should precede conclusion, not follow it
     372
     373* the article should have a related work section (2-3 pages) comparing
     374  the design overall with various competing designs (C++, Java, go,
     375  Rust,...)
     376
     377To encourage accountability, I'm signing my reviews in 2018. For the record, I am James Noble, kjx@ecs.vuw.ac.nz.
     378
     379Reviewing: 3
     380
     381Comments to the Author
     382This paper describes the design and implementation of coroutine- and thread-based concurrency in the C-for-all (I will write "C\/") system, a considerably extended form of the C language with many concurrency features.
     383
     384It first provides an overview of the non-concurrency-related aspects of the host language (references, operator overloading, generics, etc.), then addresses several technical issues around concurrency, including the multi-monitor design, bulk acquiring of locks (including deadlock-avoiding management of acquisition order), solutions to difficult scheduling problems around these, and implementation of monitors in the presence of separate compilation. It also presents empirical data showing the execution times of several microbenchmarks in comparison with other threaded concurrency systems, in support of the claim that the implementation is competitive with them.
     385
     386Overall the impression I gained is that this is a substantial system into which have gone much thought and effort.
     387
     388However, the present paper is not written so as to communicate sufficiently clearly the novel practices or experiences that emerged from that effort. This manifests itself in several ways.
     389
     390The system is described in general, rather than with a focus on novel insights or experiences. It was not until page 18 that I found a statement that hinted at a possible core contribution: "Supporting barging prevention as well as extending internal scheduling to multiple monitors is the main source of complexity in design and implementation of C\/ concurrency." Even then, it is unclear whether such challenges have already been surmounted in prior systems, or what other challenges the paper may also be covering. The most complete list of claims appears to be in the Conclusion (section 11; oddly not the last section), although not everything listed is a novel feature of the work (e.g. N:M threading models are an old idea). This presentation needs to be completely inverted, to focus from the outset on the claimed novel/noteworthy experiences that the work embodies.
     391
     392The text describing the system's motivation is unconvincing on one point: the claim that library support for threading in C is "far from widespread" (p5, footnote A). The pthreads library API is standardised, albeit not in the C language specification but rather in POSIX -- a widespread standard indeed. (With systems languages, even if the language does not define a feature, it of course does not follow that that feature is not available -- since such languages permit extension of their own runtime and/or toolchain.) Of course, the combination of C and pthreads does not provide close to the full complement of C\/-supported features, so it is easy to make a case for C\/'s targeted "gap in the market". But again, a presentation focused on novel aspects would bring this out and enable the reader to learn from the authors' efforts much more readily.
     393
     394Certain sections of the text read like a tutorial on concurrency... which is potentially valuable, but does not seem to belong here. For example, much effort is spent introducing the notions of "synchronization" and "mutual exclusion", including the whole of Section 4.2. Presently it is unclear how this content supports the findings/experiences that the paper is detailing.
     395
     396Similarly, section 8 reads mostly as a basic introduction to user versus kernel threading implementations (including hybrid models such as N:M scheduling), and appears superfluous to this paper. Mixed into this are details of C\/'s specific approach. These could instead be stated directly, with references to handle the unlikely case where the reader is unfamiliar.
     397
     398I also found the definitions of certain terms through the paper a bit non-standard, for unclear reasons. For example, why "condition lock" rather than the standard "condition variable" (if indeed that is what is intended)? To say that "synchronisation" is about "timing" strikes me as potentially confusing, since in truth synchronisation concerns only relative timing, i.e. ordering. (Even ordering is something of a derived concept -- since of course, most commonly, control over ordering is built atop synchronisation primitives, rather than being provided directly by them.)
     399
     400The empirical data presented is a reasonable start at characterising the implementation's performance. However, it currently suffers certain flaws.
     401
     402Firstly, it is not clear what is being claimed. The data cannot really be said to "verify the implementation" (section 10). Presumably the claim is that the system is competitive with other systems offering reasonably high-level concurrency constructs (Java monitors, Go channels, etc.) and/or on low-level facilities (mutexes, coroutines). A claim of this form, emphasising the latter, does eventually appear in the Conclusion, but it needs to be made explicitly during the presentation of the experiments. Shifting the focus towards higher-level features may be a better target, since this appears to be C\/'s main advance over pthreads and similar libraries.
     403
     404It appears some additional or alternative competitor systems might be a better match. For example, many green-thread or N:M libraries for C exist (libdill/libmill, Marcel, even GNU Pth). It would be instructive to compare with these.
     405
     406It would help greatly if the "functionally identical" benchmark code that was run on the competing systems were made available somewhere. Omitting it from the main text of the paper is understandable, since it would take too much space, but its details may still have a critical bearing on the results.
     407
     408In some cases it simply wasn't clear what is being compared. In Table 3, what are "FetchAdd + FetchSub"? I'm guessing this is some open-coded mutex using C++ atomics, but (unless I'm missing something) I cannot see an explanation in the text.
     409
     410The reports of variance (or, rather, standard deviation) are not always plausible. Is there really no observable variation in three of Table 3's cases? At the least, I would appreciate more detail on the measures taken to reduce run-time variance (e.g. disabling CPU throttling perhaps?).
     411
     412The text habitually asserts the benefits of C\/'s design without convincing argument. For example, in 2.1, do C\/'s references really reduce "syntactic noise"? I am sympathetic to the problem here, because many design trade-offs simply cannot be evaluated without very large-scale or long-term studies. However, the authors could easily refrain from extrapolating to a grand claim that cannot be substantiated. For example, instead of saying C\/ is "expressive" or "flexible" or "natural", or (say) that fork/join concurrency is "awkward and unnecessary" (p11), it would be preferable simply to give examples of the cases are captured well in the C\/ design (ideally together with any less favourable examples that illustrate the design trade-off in question) and let them speak for themselves.
     413
     414One thing I found confusing in the presentation of coroutines is that it elides the distinction between "coroutines" (i.e. their definitions) and activations thereof. It would be helpful to make this clearer, since at present this makes some claims/statements hard to understand. For example, much of 3.2 talks about "adding fields", which implies that a coroutine's activation state exists as fields in a structured object -- as, indeed, it does in C\/. This is non-obvious because in a more classical presentation of coroutines, their state would live not in "fields" but in local variables. Similarly, the text also talks about composition of "coroutines" as fields within other "coroutines", and so on, whereas if I understand correctly, these are also activations. (By later on in the text, the "C\/ style" of such constructs is clear, but not at first.)
     415
     416I was expecting a reference to Adya et al's 2002 Usenix ATC paper, on the topic of "fibers" and cooperative threading generally but also for its illustrative examples of stack ripping (maybe around "linearized code is the bane of device drivers", p7, which seems to be making a similar observation).
     417
     418Minor comments:
     419
     420The writing is rather patchy. It has many typos, and also some cases of "not meaning what is said", unclear allusions, etc.. The following is a non-exhaustive list.
     421
     422- p2 line 7: "C has a notion of objects" -- true, but this is not intended as "object" in anything like the same sense as "object-oriented", so raising it here is somewhere between confusing and meaningless.
     423
     424- lots of extraneous hyphenation e.g "inheritance-relationships", "critical-section", "mutual-exclusion", "shared-state" (as a general rule, only hyphenate noun phrases when making an adjective out of them)
     425
     426- p4 "impossible in most type systems" -- this is not a property of the "type system" as usually understood, merely the wider language design
     427
     428- p17: "release all acquired mutex types in the parameter list" should just say "release all acquired mutexes that are designated in the parameter list" (it is not "types" that are being released or acquired);
     429
     430- p19: "a class includes an exhaustive list of operations" -- except it is definitively *not* exhaustive, for the reasons given immediately afterwards. I do see the problem here, about separate compilation meaning that the space of functions using a particular type is not bounded at compile time, but that needs to be identified clearly as the problem. (Incidentally, one idea is that perhaps this mapping onto a dense space could be solved at link- or load-time, in preference to run-time indirection.)
     431
     432- p22: in 6.5, the significance of this design decision ("threads... are monitors") was still not clear to me.
     433
     434- p22: [user threads are] "the truest realization of concurrency" sounds like unnecessary editorializing (many systems can exist that can also encode all others, without necessarily giving one supremacy... e.g. actors can be used to encode shared-state concurrency).
     435
     436- p24: on line 19, the necessary feature is not "garbage collection" but precise pointer identification (which is distinct; not all GCs have it, and it has other applications besides GC)
     437
     438- p24: lines 32-39 are very dense and of unclear significance; an example, including code, would be much clearer.
     439
     440- p25: "current UNIX systems" seems to mean "Linux", so please say that or give the behaviour or some other modern Unix (I believe Solaris is somewhat different, and possibly the BSDs too). Also, in the explanation of signal dynamics, it would be useful to adopt the quotation's own terminology of "process-directed" signals. Presumably the "internal" thread-directed signals were generated using tgkill()? And presumably the timer expiry signal is left unblocked only on the thread (virtual processor) running the "simulation"? (Calling it a "simulation" is a bit odd, although I realise it is borrowing the concept of a discrete event queue.)
     441
  • driver/Makefile.in

    r9d9a451 r53bb8f1  
    187187DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
    188188ACLOCAL = @ACLOCAL@
    189 ALLOCA = @ALLOCA@
    190189AMTAR = @AMTAR@
    191190AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
  • driver/cfa.cc

    r9d9a451 r53bb8f1  
    1010// Created On       : Tue Aug 20 13:44:49 2002
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Sep 14 23:02:59 2018
    13 // Update Count     : 277
     12// Last Modified On : Sun Feb 10 08:28:09 2019
     13// Update Count     : 281
    1414//
    1515
     
    107107        bool link = true;                                                                       // linking as well as compiling
    108108        bool verbose = false;                                                           // -v flag
    109         bool quiet = false;                                                                     // -quiet flag
    110         bool debug = true;                                                                      // -debug flag
    111         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
    112113        bool CFA_flag = false;                                                          // -CFA flag
    113114        bool cpp_flag = false;                                                          // -E or -M flag, preprocessor only
     
    162163                                debug = true;                                                   // strip the debug flag
    163164                        } else if ( arg == "-nodebug" ) {
    164                                 debug = false;                                                  // strip the nodebug flag
     165                                debug = false;                                                  // strip the debug flag
     166                        } else if ( arg == "-nolib" ) {
     167                                nolib = true;                                                   // strip the nodebug flag
    165168                        } else if ( arg == "-quiet" ) {
    166169                                quiet = true;                                                   // strip the quiet flag
     
    366369                }  // if
    367370        } // if
    368         const char * config = debug ? "debug": "nodebug";
     371        const char * config = nolib ? "nolib" : (debug ? "debug": "nodebug");
    369372        string libdir = libbase + arch + "-" + config;
    370373
    371         if ( ! dirExists( libdir ) ) {
     374        if ( ! nolib && ! dirExists( libdir ) ) {
    372375                cerr << argv[0] << " internal error, configuration " << config << " not installed." << endl;
    373376                cerr << "Was looking for " << libdir << endl;
     
    384387        nargs += 1;
    385388
     389        for ( int i = 0; i < nlibs; i += 1 ) {                          // copy non-user libraries after all user libraries
     390                args[nargs] = libs[i];
     391                nargs += 1;
     392        } // for
     393
    386394        if ( link ) {
    387395                args[nargs] = "-Xlinker";
     
    414422                nargs += 1;
    415423                args[nargs] = "-lrt";
     424                nargs += 1;
     425                args[nargs] = "-lm";
    416426                nargs += 1;
    417427        } // if
     
    488498                args[nargs] = "-Wno-deprecated";
    489499                nargs += 1;
     500#ifdef HAVE_CAST_FUNCTION_TYPE
     501                args[nargs] = "-Wno-cast-function-type";
     502                nargs += 1;
     503#endif // HAVE_CAST_FUNCTION_TYPE
    490504                if ( ! std_flag ) {                                                             // default c11, if none specified
    491505                        args[nargs] = "-std=gnu11";
     
    497511                nargs += 1;
    498512                args[nargs] = ( *new string( string("-B") + Bprefix ) ).c_str();
    499                 nargs += 1;
    500                 args[nargs] = "-lm";
    501513                nargs += 1;
    502514        } else {
     
    504516                exit( EXIT_FAILURE );
    505517        } // if
    506 
    507         for ( int i = 0; i < nlibs; i += 1 ) {                          // copy non-user libraries after all user libraries
    508                 args[nargs] = libs[i];
    509                 nargs += 1;
    510         } // for
    511518
    512519        args[nargs] = NULL;                                                                     // terminate with NULL
  • libcfa/configure

    r9d9a451 r53bb8f1  
    23822382
    23832383
     2384# http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=blob_plain;f=m4/ax_check_compile_flag.m4
     2385
    23842386
    23852387am__api_version='1.15'
     
    29682970        "nolib"   )
    29692971                CONFIG_CFLAGS="-O2 -s"
    2970                 CONFIG_CFAFLAGS="-nodebug"
     2972                CONFIG_CFAFLAGS="-nolib"
    29712973                CONFIG_BUILDLIB="no"
    29722974        ;;
  • libcfa/configure.ac

    r9d9a451 r53bb8f1  
    5656        "nolib"   )
    5757                CONFIG_CFLAGS="-O2 -s"
    58                 CONFIG_CFAFLAGS="-nodebug"
     58                CONFIG_CFAFLAGS="-nolib"
    5959                CONFIG_BUILDLIB="no"
    6060        ;;
  • libcfa/prelude/builtins.c

    r9d9a451 r53bb8f1  
    1010// Created On       : Fri Jul 21 16:21:03 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Aug  5 21:40:38 2018
    13 // Update Count     : 20
     12// Last Modified On : Sun Mar 10 10:52:50 2019
     13// Update Count     : 31
    1414//
    1515
     
    2626// increment/decrement unification
    2727
    28 static inline forall( dtype T | { T& ?+=?( T&, one_t ); } )
    29 T& ++? ( T& x ) { return x += 1; }
     28static inline forall( dtype T | { T & ?+=?( T &, one_t ); } )
     29T & ++? ( T & x ) { return x += 1; }
    3030
    31 static inline forall( dtype T | sized(T) | { void ?{}( T&, T ); void ^?{}( T& ); T& ?+=?( T&, one_t ); } )
    32 T& ?++ ( T& x ) { T tmp = x; x += 1; return tmp; }
     31static inline forall( dtype T | sized(T) | { void ?{}( T &, T ); void ^?{}( T & ); T & ?+=?( T &, one_t ); } )
     32T & ?++ ( T & x ) { T tmp = x; x += 1; return tmp; }
    3333
    34 static inline forall( dtype T | { T& ?-=?( T&, one_t ); } )
    35 T& --? ( T& x ) { return x -= 1; }
     34static inline forall( dtype T | { T & ?-=?( T &, one_t ); } )
     35T & --? ( T & x ) { return x -= 1; }
    3636
    37 static inline forall( dtype T | sized(T) | { void ?{}( T&, T ); void ^?{}( T& ); T& ?-=?( T&, one_t ); } )
    38 T& ?-- ( T& x ) { T tmp = x; x -= 1; return tmp; }
     37static inline forall( dtype T | sized(T) | { void ?{}( T &, T ); void ^?{}( T & ); T & ?-=?( T &, one_t ); } )
     38T & ?-- ( T & x ) { T tmp = x; x -= 1; return tmp; }
     39
     40// universal typed pointer constant
     41
     42static inline forall( dtype T ) T * intptr( uintptr_t addr ) { return (T *)addr; }
    3943
    4044// exponentiation operator implementation
  • libcfa/prelude/extras.c

    r9d9a451 r53bb8f1  
    1 #include <stddef.h>                                     // size_t, ptrdiff_t
     1#include <stddef.h>                                     // size_t, ptrdiff_t, intptr_t, uintptr_t
    22#include <stdint.h>                                     // intX_t, uintX_t, where X is 8, 16, 32, 64
    33#include <uchar.h>                                      // char16_t, char32_t
  • libcfa/prelude/extras.regx

    r9d9a451 r53bb8f1  
    11typedef.* size_t;
    22typedef.* ptrdiff_t;
     3typedef.* intptr_t;
     4typedef.* uintptr_t;
    35typedef.* __int8_t;
    46typedef.* __int16_t;
  • libcfa/prelude/prelude-gen.cc

    r9d9a451 r53bb8f1  
     1//
     2// Cforall Version 1.0.0 Copyright (C) 2018 University of Waterloo
     3//
     4// The contents of this file are covered under the licence agreement in the
     5// file "LICENCE" distributed with Cforall.
     6//
     7// prelude-gen.cc --
     8//
     9// Author           : Rob Schluntz and Thierry Delisle
     10// Created On       : Sat Feb 16 08:44:58 2019
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Fri Mar  8 16:00:22 2019
     13// Update Count     : 26
     14//
     15
    116#include <algorithm>
    217#include <array>
     
    1126        bool hasComparison;
    1227} basicTypes[] = {
    13         // { "char"                  , false, true , },
    14         // { "signed char"           , false, true , },
    15         // { "unsigned char"         , false, true , },
     28        { "char"                  , false, true , },
     29        { "signed char"           , false, true , },
     30        { "unsigned char"         , false, true , },
    1631        { "signed short"          , false, true , },
    1732        { "unsigned short"        , false, true , },
     
    3449#if defined(__i386__) || defined(__ia64__) || defined(__x86_64__)
    3550        { "__float80"             , true , true , },
    36         { "_Float128"             , true , true , },
     51        { "__float128"            , true , true , },
    3752#endif
    3853};
     
    150165        cout << endl;
    151166
    152         cout << "signed int ?==?( zero_t, zero_t ),                                                     ?!=?( zero_t, zero_t );" << endl;
    153         cout << "signed int ?==?( one_t, one_t ),                                                       ?!=?( one_t, one_t );" << endl;
    154         cout << "signed int ?==?( _Bool, _Bool ),                                                       ?!=?( _Bool, _Bool );" << endl;
    155         cout << "signed int     !?( _Bool );" << endl;
     167        cout << "signed int ?==?( zero_t, zero_t ),     ?!=?( zero_t, zero_t );" << endl;
     168        cout << "signed int ?==?( one_t, one_t ),       ?!=?( one_t, one_t );" << endl;
     169        cout << "signed int ?==?( _Bool, _Bool ),       ?!=?( _Bool, _Bool );" << endl;
     170        cout << "signed int !?( _Bool );" << endl;
    156171
    157172        for (auto op : arithmeticOperators) {
     
    188203        cout << "// Arithmetic Constructors //" << endl;
    189204        cout << "/////////////////////////////" << endl;
     205        cout << endl;
     206
    190207        auto otype = [](const std::string & type, bool do_volatile = false) {
    191                 cout << "void \t?{} ( " << type << " & );" << endl;
    192                 cout << "void \t?{} ( " << type << " &, " << type << " );" << endl;
    193                 cout << type << " \t?=? ( " << type << " &, " << type << " )";
    194                 if( do_volatile ) {
    195                         cout << ", \t?=?( volatile " << type << " &, " << type << " )";
     208                cout << "void ?{} (" << type << " &);" << endl;
     209                cout << "void ?{} (" << type << " &, " << type << ");" << endl;
     210                cout << type << "  ?=? (" << type << " &, " << type << ")";
     211                if ( do_volatile ) {
     212                        cout << ",  ?=?(volatile " << type << " &, " << type << ")";
    196213                }
    197214                cout << ";" << endl;
    198                 cout << "void \t^?{}( " << type << " & );" << endl;
     215                cout << "void ^?{}( " << type << " & );" << endl;
    199216        };
    200217
     
    202219        otype("one_t");
    203220        otype("_Bool", true);
    204         otype("char", true);
    205         otype("signed char", true);
    206         otype("unsigned char", true);
     221        cout << endl;
    207222
    208223        for (auto type : basicTypes) {
    209                 cout << "void  ?{}(" << type.name << " &);" << endl;
    210                 cout << "void  ?{}(" << type.name << " &, " << type.name << ");" << endl;
     224                cout << "void ?{}(" << type.name << " &);" << endl;
     225                cout << "void ?{}(" << type.name << " &, " << type.name << ");" << endl;
     226                cout << "void ?{}(" << type.name << " &, zero_t);" << endl;
    211227                cout << "void ^?{}(" << type.name << " &);" << endl;
    212228                cout << endl;
     
    217233        cout << "// Pointer Constructors //" << endl;
    218234        cout << "//////////////////////////" << endl;
    219         cout << "forall(ftype FT) void  ?{}( FT *&, FT * );" << endl;
    220         cout << "forall(ftype FT) void  ?{}( FT * volatile &, FT * );" << endl;
     235        cout << endl;
     236
     237        cout << "forall(ftype FT) void ?{}( FT *&, FT * );" << endl;
     238        cout << "forall(ftype FT) void ?{}( FT * volatile &, FT * );" << endl;
    221239
    222240        // generate qualifiers
     
    242260                for (auto cvq : qualifiersPair) {
    243261                        for (auto is_vol : { "        ", "volatile" }) {
    244                                 cout << "forall(dtype DT) void  ?{}(" << cvq.first << type << " * " << is_vol << " &, " << cvq.second << "DT *);" << endl;
     262                                cout << "forall(dtype DT) void ?{}(" << cvq.first << type << " * " << is_vol << " &, " << cvq.second << "DT *);" << endl;
    245263                        }
    246264                }
    247265                for (auto cvq : qualifiersSingle) {
    248266                        for (auto is_vol : { "        ", "volatile" }) {
    249                                 cout << "forall(dtype DT) void  ?{}(" << cvq << type << " * " << is_vol << " &);" << endl;
     267                                cout << "forall(dtype DT) void ?{}(" << cvq << type << " * " << is_vol << " &);" << endl;
    250268                        }
    251269                        for (auto is_vol : { "        ", "volatile" }) {
     
    269287        cout << "forall(ftype FT) FT *                  ?=?( FT *          &, zero_t );" << endl;
    270288        cout << "forall(ftype FT) FT *                  ?=?( FT * volatile &, zero_t );" << endl;
    271         cout << "forall( ftype FT ) void        ?{}( FT *          & );" << endl;
    272         cout << "forall( ftype FT ) void        ^?{}( FT *         & );" << endl;
     289        cout << "forall(ftype FT) void  ?{}( FT *          & );" << endl;
     290        cout << "forall(ftype FT) void  ^?{}( FT *         & );" << endl;
    273291        cout << endl;
    274292
     
    277295        cout << "///////////////////////" << endl;
    278296
    279         cout << "forall( ftype FT ) FT *                        ?=?( FT *&, FT * );" << endl;
    280         cout << "forall( ftype FT ) FT *                        ?=?( FT * volatile &, FT * );" << endl;
    281         cout << "forall( ftype FT ) int !?( FT * );" << endl;
    282         cout << "forall( ftype FT ) signed int ?==?( FT *, FT * );" << endl;
    283         cout << "forall( ftype FT ) signed int ?!=?( FT *, FT * );" << endl;
    284         cout << "forall( ftype FT ) FT &                 *?( FT * );" << endl;
    285 
     297        cout << "forall(ftype FT) FT *                  ?=?( FT *&, FT * );" << endl;
     298        cout << "forall(ftype FT) FT *                  ?=?( FT * volatile &, FT * );" << endl;
     299        cout << "forall(ftype FT) int !?( FT * );" << endl;
     300        cout << "forall(ftype FT) signed int ?==?( FT *, FT * );" << endl;
     301        cout << "forall(ftype FT) signed int ?!=?( FT *, FT * );" << endl;
     302        cout << "forall(ftype FT) FT &           *?( FT * );" << endl;
    286303
    287304        for (auto op : pointerOperators) {
     
    387404}
    388405
     406// Local Variables: //
     407// tab-width: 4 //
     408// End: //
  • libcfa/src/Makefile.in

    r9d9a451 r53bb8f1  
    415415am__v_GOC_0 = @echo "  GOC     " $@;
    416416am__v_GOC_1 =
     417UPPCC = u++
    417418UPPCOMPILE = $(UPPCC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_UPPFLAGS) $(UPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_CFLAGS) $(CFLAGS)
    418419AM_V_UPP = $(am__v_UPP_@AM_V@)
  • libcfa/src/containers/maybe.cfa

    r9d9a451 r53bb8f1  
    1010// Created On       : Wed May 24 15:40:00 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Jul 20 15:23:50 2017
    13 // Update Count     : 2
     12// Last Modified On : Sun Feb 17 11:22:03 2019
     13// Update Count     : 3
    1414//
    1515
     
    3939forall(otype T)
    4040maybe(T) ?=?(maybe(T) & this, maybe(T) that) {
    41         if (this.has_value & that.has_value) {
     41        if (this.has_value && that.has_value) {
    4242                this.value = that.value;
    4343        } else if (this.has_value) {
  • libcfa/src/containers/result.cfa

    r9d9a451 r53bb8f1  
    1010// Created On       : Wed May 24 15:40:00 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Jul 20 15:23:58 2017
    13 // Update Count     : 2
     12// Last Modified On : Sun Feb 17 11:24:04 2019
     13// Update Count     : 3
    1414//
    1515
     
    4848forall(otype T, otype E)
    4949result(T, E) ?=?(result(T, E) & this, result(T, E) that) {
    50         if (this.has_value & that.has_value) {
     50        if (this.has_value && that.has_value) {
    5151                this.value = that.value;
    5252        } else if (this.has_value) {
  • libcfa/src/iostream.cfa

    r9d9a451 r53bb8f1  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Dec 24 18:33:40 2018
    13 // Update Count     : 589
     12// Last Modified On : Mon Mar  4 20:57:24 2019
     13// Update Count     : 593
    1414//
    1515
     
    2727
    2828forall( dtype ostype | ostream( ostype ) ) {
     29        ostype & ?|?( ostype & os, zero_t ) {
     30                if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
     31                fmt( os, "%d", 0n );
     32                return os;
     33        } // ?|?
     34        void ?|?( ostype & os, zero_t z ) {
     35                (ostype &)(os | z); nl( os );
     36        } // ?|?
     37
     38        ostype & ?|?( ostype & os, one_t ) {
     39                if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
     40                fmt( os, "%d", 1n );
     41                return os;
     42        } // ?|?
     43        void ?|?( ostype & os, one_t o ) {
     44                (ostype &)(os | o); nl( os );
     45        } // ?|?
     46
    2947        ostype & ?|?( ostype & os, bool b ) {
    3048                if ( sepPrt( os ) ) fmt( os, "%s", sepGetCur( os ) );
  • libcfa/src/iostream.hfa

    r9d9a451 r53bb8f1  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Dec 24 18:33:40 2018
    13 // Update Count     : 220
     12// Last Modified On : Tue Feb 26 16:57:22 2019
     13// Update Count     : 221
    1414//
    1515
     
    6262
    6363forall( dtype ostype | ostream( ostype ) ) {
     64        ostype & ?|?( ostype &, zero_t );
     65        void ?|?( ostype &, zero_t );
     66        ostype & ?|?( ostype &, one_t );
     67        void ?|?( ostype &, one_t );
     68
    6469        ostype & ?|?( ostype &, bool );
    6570        void ?|?( ostype &, bool );
  • src/CodeGen/module.mk

    r9d9a451 r53bb8f1  
    1818#       ArgTweak/Mutate.cc
    1919
    20 SRC +=  CodeGen/Generate.cc \
     20SRC_CODEGEN = \
    2121        CodeGen/CodeGenerator.cc \
     22        CodeGen/FixMain.cc \
    2223        CodeGen/GenType.cc \
    23         CodeGen/FixNames.cc \
    24         CodeGen/FixMain.cc \
    2524        CodeGen/OperatorTable.cc
     25
     26
     27SRC += $(SRC_CODEGEN) CodeGen/Generate.cc CodeGen/FixNames.cc
     28SRCDEMANGLE += $(SRC_CODEGEN)
  • src/Common/PassVisitor.h

    r9d9a451 r53bb8f1  
    55#include <stack>
    66
     7#include "Common/Stats.h"
    78#include "Common/utility.h"
    89
     
    426427};
    427428
     429#include "Common/Stats.h"
     430
     431extern struct PassVisitorStats {
     432        size_t depth = 0;
     433        Stats::Counters::MaxCounter<double> * max = nullptr;
     434        Stats::Counters::AverageCounter<double> * avg = nullptr;
     435} pass_visitor_stats;
     436
    428437#include "SynTree/TypeSubstitution.h"
    429438#include "PassVisitor.impl.h"
  • src/Common/PassVisitor.impl.h

    r9d9a451 r53bb8f1  
    6767        SemanticErrorException errors;
    6868
     69        pass_visitor_stats.depth++;
     70        pass_visitor_stats.max->push(pass_visitor_stats.depth);
     71        pass_visitor_stats.avg->push(pass_visitor_stats.depth);
    6972        for ( std::list< Declaration* >::iterator i = decls.begin(); ; ++i ) {
     73
     74
    7075                // splice in new declarations after previous decl
    7176                if ( !empty( afterDecls ) ) { decls.splice( i, *afterDecls ); }
     
    8388                if ( !empty( beforeDecls ) ) { decls.splice( i, *beforeDecls ); }
    8489        }
     90        pass_visitor_stats.depth--;
    8591        if ( ! errors.isEmpty() ) {
    8692                throw errors;
     
    94100        SemanticErrorException errors;
    95101
     102        pass_visitor_stats.depth++;
     103        pass_visitor_stats.max->push(pass_visitor_stats.depth);
     104        pass_visitor_stats.avg->push(pass_visitor_stats.depth);
    96105        for ( std::list< Declaration* >::iterator i = decls.begin(); ; ++i ) {
    97106                // splice in new declarations after previous decl
     
    109118                if ( !empty( beforeDecls ) ) { decls.splice( i, *beforeDecls ); }
    110119        }
     120        pass_visitor_stats.depth--;
    111121        if ( ! errors.isEmpty() ) {
    112122                throw errors;
     
    126136        if ( ! visitor.get_visit_children() ) return;
    127137        SemanticErrorException errors;
     138
     139        pass_visitor_stats.depth++;
     140        pass_visitor_stats.max->push(pass_visitor_stats.depth);
     141        pass_visitor_stats.avg->push(pass_visitor_stats.depth);
    128142        for ( typename Container::iterator i = container.begin(); i != container.end(); ++i ) {
    129143                try {
     
    135149                }
    136150        }
     151        pass_visitor_stats.depth--;
    137152        if ( ! errors.isEmpty() ) {
    138153                throw errors;
     
    153168        if ( ! mutator.get_visit_children() ) return;
    154169        SemanticErrorException errors;
     170
     171        pass_visitor_stats.depth++;
     172        pass_visitor_stats.max->push(pass_visitor_stats.depth);
     173        pass_visitor_stats.avg->push(pass_visitor_stats.depth);
    155174        for ( typename Container::iterator i = container.begin(); i != container.end(); ++i ) {
    156175                try {
     
    163182                } // try
    164183        } // for
     184        pass_visitor_stats.depth--;
    165185        if ( ! errors.isEmpty() ) {
    166186                throw errors;
     
    185205        DeclList_t* afterDecls  = get_afterDecls();
    186206
     207        pass_visitor_stats.depth++;
     208        pass_visitor_stats.max->push(pass_visitor_stats.depth);
     209        pass_visitor_stats.avg->push(pass_visitor_stats.depth);
    187210        for ( std::list< Statement* >::iterator i = statements.begin(); i != statements.end(); ++i ) {
    188211
     
    202225                if ( !empty( beforeStmts ) ) { statements.splice( i, *beforeStmts ); }
    203226        }
     227        pass_visitor_stats.depth--;
    204228
    205229        if ( !empty( afterDecls ) ) { splice( std::back_inserter( statements ), afterDecls); }
  • src/Common/Stats/Heap.h

    r9d9a451 r53bb8f1  
    1616#pragma once
    1717
    18 namespace HeapStats {
    19         void newPass( const char * const name );
    20         void printStats();
     18namespace Stats {
     19        namespace Heap {
     20                void newPass( const char * const name );
     21                void print();
     22        }
    2123}
  • src/Common/module.mk

    r9d9a451 r53bb8f1  
    1515###############################################################################
    1616
    17 SRC += Common/SemanticError.cc \
    18        Common/UniqueName.cc \
    19        Common/DebugMalloc.cc \
    20        Common/Assert.cc \
    21        Common/Heap.cc \
    22        Common/Eval.cc
     17SRC_COMMON = \
     18      Common/Assert.cc \
     19      Common/Eval.cc \
     20      Common/PassVisitor.cc \
     21      Common/SemanticError.cc \
     22      Common/Stats/Counter.cc \
     23      Common/Stats/Heap.cc \
     24      Common/Stats/Stats.cc \
     25      Common/Stats/Time.cc \
     26      Common/UniqueName.cc
     27
     28SRC += $(SRC_COMMON) Common/DebugMalloc.cc
     29SRCDEMANGLE += $(SRC_COMMON)
  • src/Concurrency/Waitfor.cc

    r9d9a451 r53bb8f1  
    1111// Last Modified By :
    1212// Last Modified On :
    13 // Update Count     : 5
     13// Update Count     : 7
    1414//
    1515
  • src/Concurrency/module.mk

    r9d9a451 r53bb8f1  
    1515###############################################################################
    1616
    17 SRC += Concurrency/Keywords.cc \
    18        Concurrency/Waitfor.cc
     17SRC += Concurrency/Keywords.cc Concurrency/Waitfor.cc
     18SRCDEMANGLE += Concurrency/Keywords.cc
    1919
  • src/ControlStruct/ExceptTranslate.cc

    r9d9a451 r53bb8f1  
    99// Author           : Andrew Beach
    1010// Created On       : Wed Jun 14 16:49:00 2017
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Thr Aug 17 17:19:00 2017
    13 // Update Count     : 9
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Wed Feb 13 18:15:29 2019
     13// Update Count     : 11
    1414//
    1515
  • src/ControlStruct/module.mk

    r9d9a451 r53bb8f1  
    1515###############################################################################
    1616
    17 SRC +=  ControlStruct/LabelGenerator.cc \
     17SRC_CONTROLSTRUCT = \
     18        ControlStruct/ForExprMutator.cc \
    1819        ControlStruct/LabelFixer.cc \
     20        ControlStruct/LabelGenerator.cc \
    1921        ControlStruct/MLEMutator.cc \
    20         ControlStruct/Mutate.cc \
    21         ControlStruct/ForExprMutator.cc \
    22         ControlStruct/ExceptTranslate.cc
     22        ControlStruct/Mutate.cc
     23
     24SRC += $(SRC_CONTROLSTRUCT) ControlStruct/ExceptTranslate.cc
     25SRCDEMANGLE += $(SRC_CONTROLSTRUCT)
     26
  • src/GenPoly/module.mk

    r9d9a451 r53bb8f1  
    2222       GenPoly/FindFunction.cc \
    2323       GenPoly/InstantiateGeneric.cc
     24
     25SRCDEMANGLE += GenPoly/GenPoly.cc GenPoly/Lvalue.cc
     26
  • src/InitTweak/FixInit.cc

    r9d9a451 r53bb8f1  
    1010// Created On       : Wed Jan 13 16:29:30 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jun 21 17:35:05 2017
    13 // Update Count     : 74
     12// Last Modified On : Wed Feb 13 18:15:56 2019
     13// Update Count     : 76
    1414//
    1515#include "FixInit.h"
  • src/InitTweak/module.mk

    r9d9a451 r53bb8f1  
    2020        InitTweak/InitTweak.cc
    2121
     22SRCDEMANGLE += InitTweak/GenInit.cc \
     23        InitTweak/InitTweak.cc
     24
  • src/MakeLibCfa.cc

    r9d9a451 r53bb8f1  
    99// Author           : Richard C. Bilson
    1010// Created On       : Sat May 16 10:33:33 2015
    11 // Last Modified By : Rob Schluntz
    12 // Last Modified On : Fri Apr 22 13:54:15 2016
    13 // Update Count     : 40
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Sun Feb 17 21:08:09 2019
     13// Update Count     : 41
    1414//
    1515
     
    146146        } // namespace
    147147} // namespace LibCfa
     148
     149// Local Variables: //
     150// tab-width: 4 //
     151// End: //
  • src/Makefile.am

    r9d9a451 r53bb8f1  
    1010## Author           : Peter A. Buhr
    1111## Created On       : Sun May 31 08:51:46 2015
    12 ## Last Modified By : Andrew Beach
    13 ## Last Modified On : Tus Jul 25 10:34:00 2017
    14 ## Update Count     : 76
     12## Last Modified By : Peter A. Buhr
     13## Last Modified On : Fri Feb 15 09:44:09 2019
     14## Update Count     : 97
    1515###############################################################################
    1616
     
    2323      CompilationState.cc
    2424
     25SRCDEMANGLE = CompilationState.cc
     26
    2527MAINTAINERCLEANFILES =
    2628MOSTLYCLEANFILES =
    27 
    28 # Is there a way to use a variable for the directory names?
    2929
    3030include CodeGen/module.mk
     
    4343include Virtual/module.mk
    4444
     45$(addprefix $(srcdir)/, ResolvExpr/ConversionCost.cc ResolvExpr/CommonType.cc SymTab/ManglerCommon.cc) : $(srcdir)/SynTree/Type.h
     46
     47$(srcdir)/SynTree/Type.h : BasicTypes-gen.cc
     48        ${AM_V_GEN}${CXXCOMPILE} $< -o BasicTypes-gen -Wall -Wextra
     49        @./BasicTypes-gen
     50        @rm BasicTypes-gen
     51
    4552# put into lib for now
    4653cfa_cpplibdir = $(CFA_LIBDIR)
     
    5562demangler_SOURCES = SymTab/demangler.cc
    5663
    57 demangler_LDADD = libdemangle.a     # yywrap
     64demangler_LDADD = libdemangle.a -ldl                    # yywrap
    5865
    5966noinst_LIBRARIES = libdemangle.a
    60 libdemangle_a_SOURCES = SymTab/Demangle.cc SymTab/ManglerCommon.cc \
    61   SynTree/Type.cc \
    62   SynTree/VoidType.cc \
    63   SynTree/BasicType.cc \
    64   SynTree/PointerType.cc \
    65   SynTree/ArrayType.cc \
    66   SynTree/ReferenceType.cc \
    67   SynTree/FunctionType.cc \
    68   SynTree/ReferenceToType.cc \
    69   SynTree/TupleType.cc \
    70   SynTree/TypeofType.cc \
    71   SynTree/AttrType.cc \
    72   SynTree/VarArgsType.cc \
    73   SynTree/ZeroOneType.cc \
    74   SynTree/Constant.cc \
    75   SynTree/Expression.cc \
    76   SynTree/TupleExpr.cc \
    77   SynTree/CommaExpr.cc \
    78   SynTree/TypeExpr.cc \
    79   SynTree/ApplicationExpr.cc \
    80   SynTree/AddressExpr.cc \
    81   SynTree/Statement.cc \
    82   SynTree/CompoundStmt.cc \
    83   SynTree/DeclStmt.cc \
    84   SynTree/Declaration.cc \
    85   SynTree/DeclarationWithType.cc \
    86   SynTree/ObjectDecl.cc \
    87   SynTree/FunctionDecl.cc \
    88   SynTree/AggregateDecl.cc \
    89   SynTree/NamedTypeDecl.cc \
    90   SynTree/TypeDecl.cc \
    91   SynTree/Initializer.cc \
    92   SynTree/TypeSubstitution.cc \
    93   SynTree/Attribute.cc \
    94   SynTree/DeclReplacer.cc \
    95   CompilationState.cc \
    96   CodeGen/CodeGenerator.cc \
    97   CodeGen/FixMain.cc \
    98   CodeGen/GenType.cc \
    99   CodeGen/OperatorTable.cc \
    100   Common/Assert.cc \
    101   Common/Eval.cc \
    102   Common/SemanticError.cc \
    103   Common/UniqueName.cc \
    104   Concurrency/Keywords.cc \
    105   ControlStruct/ForExprMutator.cc \
    106   ControlStruct/LabelFixer.cc \
    107   ControlStruct/LabelGenerator.cc \
    108   ControlStruct/MLEMutator.cc \
    109   ControlStruct/Mutate.cc \
    110   GenPoly/GenPoly.cc \
    111   GenPoly/Lvalue.cc \
    112   InitTweak/GenInit.cc \
    113   InitTweak/InitTweak.cc \
    114   Parser/LinkageSpec.cc \
    115   ResolvExpr/AdjustExprType.cc \
    116   ResolvExpr/Alternative.cc \
    117   ResolvExpr/AlternativeFinder.cc \
    118   ResolvExpr/ExplodedActual.cc \
    119   ResolvExpr/CastCost.cc \
    120   ResolvExpr/CommonType.cc \
    121   ResolvExpr/ConversionCost.cc \
    122   ResolvExpr/CurrentObject.cc \
    123   ResolvExpr/FindOpenVars.cc \
    124   ResolvExpr/Occurs.cc \
    125   ResolvExpr/PolyCost.cc \
    126   ResolvExpr/PtrsAssignable.cc \
    127   ResolvExpr/PtrsCastable.cc \
    128   ResolvExpr/RenameVars.cc \
    129   ResolvExpr/ResolveAssertions.cc \
    130   ResolvExpr/Resolver.cc \
    131   ResolvExpr/ResolveTypeof.cc \
    132   ResolvExpr/SpecCost.cc \
    133   ResolvExpr/TypeEnvironment.cc \
    134   ResolvExpr/Unify.cc \
    135   SymTab/Autogen.cc \
    136   SymTab/FixFunction.cc \
    137   SymTab/Indexer.cc \
    138   SymTab/Mangler.cc \
    139   SymTab/Validate.cc \
    140   Tuples/Explode.cc \
    141   Tuples/TupleAssignment.cc \
    142   Tuples/TupleExpansion.cc \
    143   Validate/HandleAttributes.cc
     67libdemangle_a_SOURCES = $(SRCDEMANGLE)
    14468
    14569MAINTAINERCLEANFILES += ${libdir}/${notdir ${cfa_cpplib_PROGRAMS}}
  • src/Makefile.in

    r9d9a451 r53bb8f1  
    162162libdemangle_a_LIBADD =
    163163am__dirstamp = $(am__leading_dot)dirstamp
    164 am_libdemangle_a_OBJECTS = SymTab/Demangle.$(OBJEXT) \
    165         SymTab/ManglerCommon.$(OBJEXT) SynTree/Type.$(OBJEXT) \
    166         SynTree/VoidType.$(OBJEXT) SynTree/BasicType.$(OBJEXT) \
    167         SynTree/PointerType.$(OBJEXT) SynTree/ArrayType.$(OBJEXT) \
    168         SynTree/ReferenceType.$(OBJEXT) SynTree/FunctionType.$(OBJEXT) \
    169         SynTree/ReferenceToType.$(OBJEXT) SynTree/TupleType.$(OBJEXT) \
    170         SynTree/TypeofType.$(OBJEXT) SynTree/AttrType.$(OBJEXT) \
    171         SynTree/VarArgsType.$(OBJEXT) SynTree/ZeroOneType.$(OBJEXT) \
    172         SynTree/Constant.$(OBJEXT) SynTree/Expression.$(OBJEXT) \
    173         SynTree/TupleExpr.$(OBJEXT) SynTree/CommaExpr.$(OBJEXT) \
    174         SynTree/TypeExpr.$(OBJEXT) SynTree/ApplicationExpr.$(OBJEXT) \
    175         SynTree/AddressExpr.$(OBJEXT) SynTree/Statement.$(OBJEXT) \
    176         SynTree/CompoundStmt.$(OBJEXT) SynTree/DeclStmt.$(OBJEXT) \
    177         SynTree/Declaration.$(OBJEXT) \
    178         SynTree/DeclarationWithType.$(OBJEXT) \
    179         SynTree/ObjectDecl.$(OBJEXT) SynTree/FunctionDecl.$(OBJEXT) \
    180         SynTree/AggregateDecl.$(OBJEXT) \
    181         SynTree/NamedTypeDecl.$(OBJEXT) SynTree/TypeDecl.$(OBJEXT) \
    182         SynTree/Initializer.$(OBJEXT) \
    183         SynTree/TypeSubstitution.$(OBJEXT) SynTree/Attribute.$(OBJEXT) \
    184         SynTree/DeclReplacer.$(OBJEXT) CompilationState.$(OBJEXT) \
    185         CodeGen/CodeGenerator.$(OBJEXT) CodeGen/FixMain.$(OBJEXT) \
    186         CodeGen/GenType.$(OBJEXT) CodeGen/OperatorTable.$(OBJEXT) \
    187         Common/Assert.$(OBJEXT) Common/Eval.$(OBJEXT) \
    188         Common/SemanticError.$(OBJEXT) Common/UniqueName.$(OBJEXT) \
    189         Concurrency/Keywords.$(OBJEXT) \
    190         ControlStruct/ForExprMutator.$(OBJEXT) \
     164am__objects_1 = CodeGen/CodeGenerator.$(OBJEXT) \
     165        CodeGen/FixMain.$(OBJEXT) CodeGen/GenType.$(OBJEXT) \
     166        CodeGen/OperatorTable.$(OBJEXT)
     167am__objects_2 = Common/Assert.$(OBJEXT) Common/Eval.$(OBJEXT) \
     168        Common/PassVisitor.$(OBJEXT) Common/SemanticError.$(OBJEXT) \
     169        Common/Stats/Counter.$(OBJEXT) Common/Stats/Heap.$(OBJEXT) \
     170        Common/Stats/Stats.$(OBJEXT) Common/Stats/Time.$(OBJEXT) \
     171        Common/UniqueName.$(OBJEXT)
     172am__objects_3 = ControlStruct/ForExprMutator.$(OBJEXT) \
    191173        ControlStruct/LabelFixer.$(OBJEXT) \
    192174        ControlStruct/LabelGenerator.$(OBJEXT) \
    193175        ControlStruct/MLEMutator.$(OBJEXT) \
    194         ControlStruct/Mutate.$(OBJEXT) GenPoly/GenPoly.$(OBJEXT) \
    195         GenPoly/Lvalue.$(OBJEXT) InitTweak/GenInit.$(OBJEXT) \
    196         InitTweak/InitTweak.$(OBJEXT) Parser/LinkageSpec.$(OBJEXT) \
    197         ResolvExpr/AdjustExprType.$(OBJEXT) \
     176        ControlStruct/Mutate.$(OBJEXT)
     177am__objects_4 = ResolvExpr/AdjustExprType.$(OBJEXT) \
    198178        ResolvExpr/Alternative.$(OBJEXT) \
    199179        ResolvExpr/AlternativeFinder.$(OBJEXT) \
    200         ResolvExpr/ExplodedActual.$(OBJEXT) \
    201180        ResolvExpr/CastCost.$(OBJEXT) ResolvExpr/CommonType.$(OBJEXT) \
    202181        ResolvExpr/ConversionCost.$(OBJEXT) \
    203182        ResolvExpr/CurrentObject.$(OBJEXT) \
     183        ResolvExpr/ExplodedActual.$(OBJEXT) \
    204184        ResolvExpr/FindOpenVars.$(OBJEXT) ResolvExpr/Occurs.$(OBJEXT) \
    205185        ResolvExpr/PolyCost.$(OBJEXT) \
     
    212192        ResolvExpr/SpecCost.$(OBJEXT) \
    213193        ResolvExpr/TypeEnvironment.$(OBJEXT) \
    214         ResolvExpr/Unify.$(OBJEXT) SymTab/Autogen.$(OBJEXT) \
    215         SymTab/FixFunction.$(OBJEXT) SymTab/Indexer.$(OBJEXT) \
    216         SymTab/Mangler.$(OBJEXT) SymTab/Validate.$(OBJEXT) \
    217         Tuples/Explode.$(OBJEXT) Tuples/TupleAssignment.$(OBJEXT) \
    218         Tuples/TupleExpansion.$(OBJEXT) \
    219         Validate/HandleAttributes.$(OBJEXT)
    220 libdemangle_a_OBJECTS = $(am_libdemangle_a_OBJECTS)
    221 am__installdirs = "$(DESTDIR)$(cfa_cpplibdir)"
    222 PROGRAMS = $(cfa_cpplib_PROGRAMS)
    223 am__objects_1 = main.$(OBJEXT) MakeLibCfa.$(OBJEXT) \
    224         CompilationState.$(OBJEXT) CodeGen/Generate.$(OBJEXT) \
    225         CodeGen/CodeGenerator.$(OBJEXT) CodeGen/GenType.$(OBJEXT) \
    226         CodeGen/FixNames.$(OBJEXT) CodeGen/FixMain.$(OBJEXT) \
    227         CodeGen/OperatorTable.$(OBJEXT) CodeTools/DeclStats.$(OBJEXT) \
    228         CodeTools/ResolvProtoDump.$(OBJEXT) \
    229         CodeTools/TrackLoc.$(OBJEXT) Concurrency/Keywords.$(OBJEXT) \
    230         Concurrency/Waitfor.$(OBJEXT) Common/SemanticError.$(OBJEXT) \
    231         Common/UniqueName.$(OBJEXT) Common/DebugMalloc.$(OBJEXT) \
    232         Common/Assert.$(OBJEXT) Common/Heap.$(OBJEXT) \
    233         Common/Eval.$(OBJEXT) ControlStruct/LabelGenerator.$(OBJEXT) \
    234         ControlStruct/LabelFixer.$(OBJEXT) \
    235         ControlStruct/MLEMutator.$(OBJEXT) \
    236         ControlStruct/Mutate.$(OBJEXT) \
    237         ControlStruct/ForExprMutator.$(OBJEXT) \
    238         ControlStruct/ExceptTranslate.$(OBJEXT) GenPoly/Box.$(OBJEXT) \
    239         GenPoly/GenPoly.$(OBJEXT) GenPoly/ScrubTyVars.$(OBJEXT) \
    240         GenPoly/Lvalue.$(OBJEXT) GenPoly/Specialize.$(OBJEXT) \
    241         GenPoly/FindFunction.$(OBJEXT) \
    242         GenPoly/InstantiateGeneric.$(OBJEXT) \
    243         InitTweak/GenInit.$(OBJEXT) InitTweak/FixInit.$(OBJEXT) \
    244         InitTweak/FixGlobalInit.$(OBJEXT) \
    245         InitTweak/InitTweak.$(OBJEXT) Parser/parser.$(OBJEXT) \
    246         Parser/lex.$(OBJEXT) Parser/TypedefTable.$(OBJEXT) \
    247         Parser/ParseNode.$(OBJEXT) Parser/DeclarationNode.$(OBJEXT) \
    248         Parser/ExpressionNode.$(OBJEXT) Parser/StatementNode.$(OBJEXT) \
    249         Parser/InitializerNode.$(OBJEXT) Parser/TypeData.$(OBJEXT) \
    250         Parser/LinkageSpec.$(OBJEXT) Parser/parserutility.$(OBJEXT) \
    251         ResolvExpr/AlternativeFinder.$(OBJEXT) \
    252         ResolvExpr/Alternative.$(OBJEXT) ResolvExpr/Unify.$(OBJEXT) \
    253         ResolvExpr/PtrsAssignable.$(OBJEXT) \
    254         ResolvExpr/CommonType.$(OBJEXT) \
    255         ResolvExpr/ConversionCost.$(OBJEXT) \
    256         ResolvExpr/CastCost.$(OBJEXT) \
    257         ResolvExpr/PtrsCastable.$(OBJEXT) \
    258         ResolvExpr/AdjustExprType.$(OBJEXT) \
    259         ResolvExpr/AlternativePrinter.$(OBJEXT) \
    260         ResolvExpr/Resolver.$(OBJEXT) \
    261         ResolvExpr/ResolveTypeof.$(OBJEXT) \
    262         ResolvExpr/RenameVars.$(OBJEXT) \
    263         ResolvExpr/FindOpenVars.$(OBJEXT) \
    264         ResolvExpr/PolyCost.$(OBJEXT) ResolvExpr/Occurs.$(OBJEXT) \
    265         ResolvExpr/TypeEnvironment.$(OBJEXT) \
    266         ResolvExpr/CurrentObject.$(OBJEXT) \
    267         ResolvExpr/ExplodedActual.$(OBJEXT) \
    268         ResolvExpr/SpecCost.$(OBJEXT) \
    269         ResolvExpr/ResolveAssertions.$(OBJEXT) \
     194        ResolvExpr/Unify.$(OBJEXT)
     195am__objects_5 = SymTab/Autogen.$(OBJEXT) SymTab/FixFunction.$(OBJEXT) \
    270196        SymTab/Indexer.$(OBJEXT) SymTab/Mangler.$(OBJEXT) \
    271         SymTab/ManglerCommon.$(OBJEXT) SymTab/Validate.$(OBJEXT) \
    272         SymTab/FixFunction.$(OBJEXT) SymTab/Autogen.$(OBJEXT) \
    273         SynTree/Type.$(OBJEXT) SynTree/VoidType.$(OBJEXT) \
     197        SymTab/ManglerCommon.$(OBJEXT) SymTab/Validate.$(OBJEXT)
     198am__objects_6 = SynTree/Type.$(OBJEXT) SynTree/VoidType.$(OBJEXT) \
    274199        SynTree/BasicType.$(OBJEXT) SynTree/PointerType.$(OBJEXT) \
    275200        SynTree/ArrayType.$(OBJEXT) SynTree/ReferenceType.$(OBJEXT) \
     
    290215        SynTree/Initializer.$(OBJEXT) \
    291216        SynTree/TypeSubstitution.$(OBJEXT) SynTree/Attribute.$(OBJEXT) \
    292         SynTree/DeclReplacer.$(OBJEXT) \
     217        SynTree/DeclReplacer.$(OBJEXT)
     218am__objects_7 = CompilationState.$(OBJEXT) $(am__objects_1) \
     219        Concurrency/Keywords.$(OBJEXT) $(am__objects_2) \
     220        $(am__objects_3) GenPoly/GenPoly.$(OBJEXT) \
     221        GenPoly/Lvalue.$(OBJEXT) InitTweak/GenInit.$(OBJEXT) \
     222        InitTweak/InitTweak.$(OBJEXT) Parser/LinkageSpec.$(OBJEXT) \
     223        $(am__objects_4) $(am__objects_5) SymTab/Demangle.$(OBJEXT) \
     224        $(am__objects_6) Tuples/TupleAssignment.$(OBJEXT) \
     225        Tuples/TupleExpansion.$(OBJEXT) Tuples/Explode.$(OBJEXT) \
     226        Validate/HandleAttributes.$(OBJEXT)
     227am_libdemangle_a_OBJECTS = $(am__objects_7)
     228libdemangle_a_OBJECTS = $(am_libdemangle_a_OBJECTS)
     229am__installdirs = "$(DESTDIR)$(cfa_cpplibdir)"
     230PROGRAMS = $(cfa_cpplib_PROGRAMS)
     231am__objects_8 = main.$(OBJEXT) MakeLibCfa.$(OBJEXT) \
     232        CompilationState.$(OBJEXT) $(am__objects_1) \
     233        CodeGen/Generate.$(OBJEXT) CodeGen/FixNames.$(OBJEXT) \
     234        CodeTools/DeclStats.$(OBJEXT) \
     235        CodeTools/ResolvProtoDump.$(OBJEXT) \
     236        CodeTools/TrackLoc.$(OBJEXT) Concurrency/Keywords.$(OBJEXT) \
     237        Concurrency/Waitfor.$(OBJEXT) $(am__objects_2) \
     238        Common/DebugMalloc.$(OBJEXT) $(am__objects_3) \
     239        ControlStruct/ExceptTranslate.$(OBJEXT) GenPoly/Box.$(OBJEXT) \
     240        GenPoly/GenPoly.$(OBJEXT) GenPoly/ScrubTyVars.$(OBJEXT) \
     241        GenPoly/Lvalue.$(OBJEXT) GenPoly/Specialize.$(OBJEXT) \
     242        GenPoly/FindFunction.$(OBJEXT) \
     243        GenPoly/InstantiateGeneric.$(OBJEXT) \
     244        InitTweak/GenInit.$(OBJEXT) InitTweak/FixInit.$(OBJEXT) \
     245        InitTweak/FixGlobalInit.$(OBJEXT) \
     246        InitTweak/InitTweak.$(OBJEXT) Parser/parser.$(OBJEXT) \
     247        Parser/lex.$(OBJEXT) Parser/TypedefTable.$(OBJEXT) \
     248        Parser/ParseNode.$(OBJEXT) Parser/DeclarationNode.$(OBJEXT) \
     249        Parser/ExpressionNode.$(OBJEXT) Parser/StatementNode.$(OBJEXT) \
     250        Parser/InitializerNode.$(OBJEXT) Parser/TypeData.$(OBJEXT) \
     251        Parser/LinkageSpec.$(OBJEXT) Parser/parserutility.$(OBJEXT) \
     252        $(am__objects_4) ResolvExpr/AlternativePrinter.$(OBJEXT) \
     253        $(am__objects_5) $(am__objects_6) \
    293254        Tuples/TupleAssignment.$(OBJEXT) \
    294255        Tuples/TupleExpansion.$(OBJEXT) Tuples/Explode.$(OBJEXT) \
    295256        Validate/HandleAttributes.$(OBJEXT) \
    296257        Virtual/ExpandCasts.$(OBJEXT)
    297 am____driver_cfa_cpp_OBJECTS = $(am__objects_1)
     258am____driver_cfa_cpp_OBJECTS = $(am__objects_8)
    298259___driver_cfa_cpp_OBJECTS = $(am____driver_cfa_cpp_OBJECTS)
    299260___driver_cfa_cpp_DEPENDENCIES =
     
    416377DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
    417378ACLOCAL = @ACLOCAL@
    418 ALLOCA = @ALLOCA@
    419379AMTAR = @AMTAR@
    420380AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
     
    564524AUTOMAKE_OPTIONS = foreign subdir-objects
    565525ACLOCAL_AMFLAGS = -I automake
    566 SRC = main.cc MakeLibCfa.cc CompilationState.cc CodeGen/Generate.cc \
    567         CodeGen/CodeGenerator.cc CodeGen/GenType.cc \
    568         CodeGen/FixNames.cc CodeGen/FixMain.cc \
    569         CodeGen/OperatorTable.cc CodeTools/DeclStats.cc \
     526SRC = main.cc MakeLibCfa.cc CompilationState.cc $(SRC_CODEGEN) \
     527        CodeGen/Generate.cc CodeGen/FixNames.cc CodeTools/DeclStats.cc \
    570528        CodeTools/ResolvProtoDump.cc CodeTools/TrackLoc.cc \
    571         Concurrency/Keywords.cc Concurrency/Waitfor.cc \
    572         Common/SemanticError.cc Common/UniqueName.cc \
    573         Common/DebugMalloc.cc Common/Assert.cc Common/Heap.cc \
    574         Common/Eval.cc ControlStruct/LabelGenerator.cc \
    575         ControlStruct/LabelFixer.cc ControlStruct/MLEMutator.cc \
    576         ControlStruct/Mutate.cc ControlStruct/ForExprMutator.cc \
     529        Concurrency/Keywords.cc Concurrency/Waitfor.cc $(SRC_COMMON) \
     530        Common/DebugMalloc.cc $(SRC_CONTROLSTRUCT) \
    577531        ControlStruct/ExceptTranslate.cc GenPoly/Box.cc \
    578532        GenPoly/GenPoly.cc GenPoly/ScrubTyVars.cc GenPoly/Lvalue.cc \
     
    585539        Parser/StatementNode.cc Parser/InitializerNode.cc \
    586540        Parser/TypeData.cc Parser/LinkageSpec.cc \
    587         Parser/parserutility.cc ResolvExpr/AlternativeFinder.cc \
    588         ResolvExpr/Alternative.cc ResolvExpr/Unify.cc \
    589         ResolvExpr/PtrsAssignable.cc ResolvExpr/CommonType.cc \
    590         ResolvExpr/ConversionCost.cc ResolvExpr/CastCost.cc \
    591         ResolvExpr/PtrsCastable.cc ResolvExpr/AdjustExprType.cc \
    592         ResolvExpr/AlternativePrinter.cc ResolvExpr/Resolver.cc \
    593         ResolvExpr/ResolveTypeof.cc ResolvExpr/RenameVars.cc \
    594         ResolvExpr/FindOpenVars.cc ResolvExpr/PolyCost.cc \
    595         ResolvExpr/Occurs.cc ResolvExpr/TypeEnvironment.cc \
    596         ResolvExpr/CurrentObject.cc ResolvExpr/ExplodedActual.cc \
    597         ResolvExpr/SpecCost.cc ResolvExpr/ResolveAssertions.cc \
    598         SymTab/Indexer.cc SymTab/Mangler.cc SymTab/ManglerCommon.cc \
    599         SymTab/Validate.cc SymTab/FixFunction.cc SymTab/Autogen.cc \
    600         SynTree/Type.cc SynTree/VoidType.cc SynTree/BasicType.cc \
    601         SynTree/PointerType.cc SynTree/ArrayType.cc \
    602         SynTree/ReferenceType.cc SynTree/FunctionType.cc \
    603         SynTree/ReferenceToType.cc SynTree/TupleType.cc \
    604         SynTree/TypeofType.cc SynTree/AttrType.cc \
    605         SynTree/VarArgsType.cc SynTree/ZeroOneType.cc \
    606         SynTree/Constant.cc SynTree/Expression.cc SynTree/TupleExpr.cc \
    607         SynTree/CommaExpr.cc SynTree/TypeExpr.cc \
    608         SynTree/ApplicationExpr.cc SynTree/AddressExpr.cc \
    609         SynTree/Statement.cc SynTree/CompoundStmt.cc \
    610         SynTree/DeclStmt.cc SynTree/Declaration.cc \
    611         SynTree/DeclarationWithType.cc SynTree/ObjectDecl.cc \
    612         SynTree/FunctionDecl.cc SynTree/AggregateDecl.cc \
    613         SynTree/NamedTypeDecl.cc SynTree/TypeDecl.cc \
    614         SynTree/Initializer.cc SynTree/TypeSubstitution.cc \
    615         SynTree/Attribute.cc SynTree/DeclReplacer.cc \
     541        Parser/parserutility.cc $(SRC_RESOLVEXPR) \
     542        ResolvExpr/AlternativePrinter.cc $(SRC_SYMTAB) $(SRC_SYNTREE) \
    616543        Tuples/TupleAssignment.cc Tuples/TupleExpansion.cc \
    617544        Tuples/Explode.cc Validate/HandleAttributes.cc \
    618545        Virtual/ExpandCasts.cc
     546SRCDEMANGLE = CompilationState.cc $(SRC_CODEGEN) \
     547        Concurrency/Keywords.cc $(SRC_COMMON) $(SRC_CONTROLSTRUCT) \
     548        GenPoly/GenPoly.cc GenPoly/Lvalue.cc InitTweak/GenInit.cc \
     549        InitTweak/InitTweak.cc Parser/LinkageSpec.cc $(SRC_RESOLVEXPR) \
     550        $(SRC_SYMTAB) SymTab/Demangle.cc $(SRC_SYNTREE) \
     551        Tuples/TupleAssignment.cc Tuples/TupleExpansion.cc \
     552        Tuples/Explode.cc Validate/HandleAttributes.cc
    619553MAINTAINERCLEANFILES = ${libdir}/${notdir ${cfa_cpplib_PROGRAMS}}
    620 MOSTLYCLEANFILES = Parser/parser.hh Parser/parser.output
     554MOSTLYCLEANFILES = Parser/lex.cc Parser/parser.cc Parser/parser.hh \
     555        Parser/parser.output
     556SRC_CODEGEN = \
     557        CodeGen/CodeGenerator.cc \
     558        CodeGen/FixMain.cc \
     559        CodeGen/GenType.cc \
     560        CodeGen/OperatorTable.cc
     561
     562SRC_COMMON = \
     563      Common/Assert.cc \
     564      Common/Eval.cc \
     565      Common/PassVisitor.cc \
     566      Common/SemanticError.cc \
     567      Common/Stats/Counter.cc \
     568      Common/Stats/Heap.cc \
     569      Common/Stats/Stats.cc \
     570      Common/Stats/Time.cc \
     571      Common/UniqueName.cc
     572
     573SRC_CONTROLSTRUCT = \
     574        ControlStruct/ForExprMutator.cc \
     575        ControlStruct/LabelFixer.cc \
     576        ControlStruct/LabelGenerator.cc \
     577        ControlStruct/MLEMutator.cc \
     578        ControlStruct/Mutate.cc
     579
    621580BUILT_SOURCES = Parser/parser.hh
    622581AM_YFLAGS = -d -t -v
    623 
    624 # Is there a way to use a variable for the directory names?
     582SRC_RESOLVEXPR = \
     583      ResolvExpr/AdjustExprType.cc \
     584      ResolvExpr/Alternative.cc \
     585      ResolvExpr/AlternativeFinder.cc \
     586      ResolvExpr/CastCost.cc \
     587      ResolvExpr/CommonType.cc \
     588      ResolvExpr/ConversionCost.cc \
     589      ResolvExpr/CurrentObject.cc \
     590      ResolvExpr/ExplodedActual.cc \
     591      ResolvExpr/FindOpenVars.cc \
     592      ResolvExpr/Occurs.cc \
     593      ResolvExpr/PolyCost.cc \
     594      ResolvExpr/PtrsAssignable.cc \
     595      ResolvExpr/PtrsCastable.cc \
     596      ResolvExpr/RenameVars.cc \
     597      ResolvExpr/ResolveAssertions.cc \
     598      ResolvExpr/Resolver.cc \
     599      ResolvExpr/ResolveTypeof.cc \
     600      ResolvExpr/SpecCost.cc \
     601      ResolvExpr/TypeEnvironment.cc \
     602      ResolvExpr/Unify.cc
     603
     604SRC_SYMTAB = \
     605      SymTab/Autogen.cc \
     606      SymTab/FixFunction.cc \
     607      SymTab/Indexer.cc \
     608      SymTab/Mangler.cc \
     609      SymTab/ManglerCommon.cc \
     610      SymTab/Validate.cc
     611
     612SRC_SYNTREE = \
     613      SynTree/Type.cc \
     614      SynTree/VoidType.cc \
     615      SynTree/BasicType.cc \
     616      SynTree/PointerType.cc \
     617      SynTree/ArrayType.cc \
     618      SynTree/ReferenceType.cc \
     619      SynTree/FunctionType.cc \
     620      SynTree/ReferenceToType.cc \
     621      SynTree/TupleType.cc \
     622      SynTree/TypeofType.cc \
     623      SynTree/AttrType.cc \
     624      SynTree/VarArgsType.cc \
     625      SynTree/ZeroOneType.cc \
     626      SynTree/Constant.cc \
     627      SynTree/Expression.cc \
     628      SynTree/TupleExpr.cc \
     629      SynTree/CommaExpr.cc \
     630      SynTree/TypeExpr.cc \
     631      SynTree/ApplicationExpr.cc \
     632      SynTree/AddressExpr.cc \
     633      SynTree/Statement.cc \
     634      SynTree/CompoundStmt.cc \
     635      SynTree/DeclStmt.cc \
     636      SynTree/Declaration.cc \
     637      SynTree/DeclarationWithType.cc \
     638      SynTree/ObjectDecl.cc \
     639      SynTree/FunctionDecl.cc \
     640      SynTree/AggregateDecl.cc \
     641      SynTree/NamedTypeDecl.cc \
     642      SynTree/TypeDecl.cc \
     643      SynTree/Initializer.cc \
     644      SynTree/TypeSubstitution.cc \
     645      SynTree/Attribute.cc \
     646      SynTree/DeclReplacer.cc
     647
    625648
    626649# put into lib for now
     
    632655ARFLAGS = cr
    633656demangler_SOURCES = SymTab/demangler.cc
    634 demangler_LDADD = libdemangle.a     # yywrap
     657demangler_LDADD = libdemangle.a -ldl                    # yywrap
    635658noinst_LIBRARIES = libdemangle.a
    636 libdemangle_a_SOURCES = SymTab/Demangle.cc SymTab/ManglerCommon.cc \
    637   SynTree/Type.cc \
    638   SynTree/VoidType.cc \
    639   SynTree/BasicType.cc \
    640   SynTree/PointerType.cc \
    641   SynTree/ArrayType.cc \
    642   SynTree/ReferenceType.cc \
    643   SynTree/FunctionType.cc \
    644   SynTree/ReferenceToType.cc \
    645   SynTree/TupleType.cc \
    646   SynTree/TypeofType.cc \
    647   SynTree/AttrType.cc \
    648   SynTree/VarArgsType.cc \
    649   SynTree/ZeroOneType.cc \
    650   SynTree/Constant.cc \
    651   SynTree/Expression.cc \
    652   SynTree/TupleExpr.cc \
    653   SynTree/CommaExpr.cc \
    654   SynTree/TypeExpr.cc \
    655   SynTree/ApplicationExpr.cc \
    656   SynTree/AddressExpr.cc \
    657   SynTree/Statement.cc \
    658   SynTree/CompoundStmt.cc \
    659   SynTree/DeclStmt.cc \
    660   SynTree/Declaration.cc \
    661   SynTree/DeclarationWithType.cc \
    662   SynTree/ObjectDecl.cc \
    663   SynTree/FunctionDecl.cc \
    664   SynTree/AggregateDecl.cc \
    665   SynTree/NamedTypeDecl.cc \
    666   SynTree/TypeDecl.cc \
    667   SynTree/Initializer.cc \
    668   SynTree/TypeSubstitution.cc \
    669   SynTree/Attribute.cc \
    670   SynTree/DeclReplacer.cc \
    671   CompilationState.cc \
    672   CodeGen/CodeGenerator.cc \
    673   CodeGen/FixMain.cc \
    674   CodeGen/GenType.cc \
    675   CodeGen/OperatorTable.cc \
    676   Common/Assert.cc \
    677   Common/Eval.cc \
    678   Common/SemanticError.cc \
    679   Common/UniqueName.cc \
    680   Concurrency/Keywords.cc \
    681   ControlStruct/ForExprMutator.cc \
    682   ControlStruct/LabelFixer.cc \
    683   ControlStruct/LabelGenerator.cc \
    684   ControlStruct/MLEMutator.cc \
    685   ControlStruct/Mutate.cc \
    686   GenPoly/GenPoly.cc \
    687   GenPoly/Lvalue.cc \
    688   InitTweak/GenInit.cc \
    689   InitTweak/InitTweak.cc \
    690   Parser/LinkageSpec.cc \
    691   ResolvExpr/AdjustExprType.cc \
    692   ResolvExpr/Alternative.cc \
    693   ResolvExpr/AlternativeFinder.cc \
    694   ResolvExpr/ExplodedActual.cc \
    695   ResolvExpr/CastCost.cc \
    696   ResolvExpr/CommonType.cc \
    697   ResolvExpr/ConversionCost.cc \
    698   ResolvExpr/CurrentObject.cc \
    699   ResolvExpr/FindOpenVars.cc \
    700   ResolvExpr/Occurs.cc \
    701   ResolvExpr/PolyCost.cc \
    702   ResolvExpr/PtrsAssignable.cc \
    703   ResolvExpr/PtrsCastable.cc \
    704   ResolvExpr/RenameVars.cc \
    705   ResolvExpr/ResolveAssertions.cc \
    706   ResolvExpr/Resolver.cc \
    707   ResolvExpr/ResolveTypeof.cc \
    708   ResolvExpr/SpecCost.cc \
    709   ResolvExpr/TypeEnvironment.cc \
    710   ResolvExpr/Unify.cc \
    711   SymTab/Autogen.cc \
    712   SymTab/FixFunction.cc \
    713   SymTab/Indexer.cc \
    714   SymTab/Mangler.cc \
    715   SymTab/Validate.cc \
    716   Tuples/Explode.cc \
    717   Tuples/TupleAssignment.cc \
    718   Tuples/TupleExpansion.cc \
    719   Validate/HandleAttributes.cc
    720 
     659libdemangle_a_SOURCES = $(SRCDEMANGLE)
    721660all: $(BUILT_SOURCES)
    722661        $(MAKE) $(AM_MAKEFLAGS) all-am
     
    757696clean-noinstLIBRARIES:
    758697        -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
    759 SymTab/$(am__dirstamp):
    760         @$(MKDIR_P) SymTab
    761         @: > SymTab/$(am__dirstamp)
    762 SymTab/$(DEPDIR)/$(am__dirstamp):
    763         @$(MKDIR_P) SymTab/$(DEPDIR)
    764         @: > SymTab/$(DEPDIR)/$(am__dirstamp)
    765 SymTab/Demangle.$(OBJEXT): SymTab/$(am__dirstamp) \
    766         SymTab/$(DEPDIR)/$(am__dirstamp)
    767 SymTab/ManglerCommon.$(OBJEXT): SymTab/$(am__dirstamp) \
    768         SymTab/$(DEPDIR)/$(am__dirstamp)
    769 SynTree/$(am__dirstamp):
    770         @$(MKDIR_P) SynTree
    771         @: > SynTree/$(am__dirstamp)
    772 SynTree/$(DEPDIR)/$(am__dirstamp):
    773         @$(MKDIR_P) SynTree/$(DEPDIR)
    774         @: > SynTree/$(DEPDIR)/$(am__dirstamp)
    775 SynTree/Type.$(OBJEXT): SynTree/$(am__dirstamp) \
    776         SynTree/$(DEPDIR)/$(am__dirstamp)
    777 SynTree/VoidType.$(OBJEXT): SynTree/$(am__dirstamp) \
    778         SynTree/$(DEPDIR)/$(am__dirstamp)
    779 SynTree/BasicType.$(OBJEXT): SynTree/$(am__dirstamp) \
    780         SynTree/$(DEPDIR)/$(am__dirstamp)
    781 SynTree/PointerType.$(OBJEXT): SynTree/$(am__dirstamp) \
    782         SynTree/$(DEPDIR)/$(am__dirstamp)
    783 SynTree/ArrayType.$(OBJEXT): SynTree/$(am__dirstamp) \
    784         SynTree/$(DEPDIR)/$(am__dirstamp)
    785 SynTree/ReferenceType.$(OBJEXT): SynTree/$(am__dirstamp) \
    786         SynTree/$(DEPDIR)/$(am__dirstamp)
    787 SynTree/FunctionType.$(OBJEXT): SynTree/$(am__dirstamp) \
    788         SynTree/$(DEPDIR)/$(am__dirstamp)
    789 SynTree/ReferenceToType.$(OBJEXT): SynTree/$(am__dirstamp) \
    790         SynTree/$(DEPDIR)/$(am__dirstamp)
    791 SynTree/TupleType.$(OBJEXT): SynTree/$(am__dirstamp) \
    792         SynTree/$(DEPDIR)/$(am__dirstamp)
    793 SynTree/TypeofType.$(OBJEXT): SynTree/$(am__dirstamp) \
    794         SynTree/$(DEPDIR)/$(am__dirstamp)
    795 SynTree/AttrType.$(OBJEXT): SynTree/$(am__dirstamp) \
    796         SynTree/$(DEPDIR)/$(am__dirstamp)
    797 SynTree/VarArgsType.$(OBJEXT): SynTree/$(am__dirstamp) \
    798         SynTree/$(DEPDIR)/$(am__dirstamp)
    799 SynTree/ZeroOneType.$(OBJEXT): SynTree/$(am__dirstamp) \
    800         SynTree/$(DEPDIR)/$(am__dirstamp)
    801 SynTree/Constant.$(OBJEXT): SynTree/$(am__dirstamp) \
    802         SynTree/$(DEPDIR)/$(am__dirstamp)
    803 SynTree/Expression.$(OBJEXT): SynTree/$(am__dirstamp) \
    804         SynTree/$(DEPDIR)/$(am__dirstamp)
    805 SynTree/TupleExpr.$(OBJEXT): SynTree/$(am__dirstamp) \
    806         SynTree/$(DEPDIR)/$(am__dirstamp)
    807 SynTree/CommaExpr.$(OBJEXT): SynTree/$(am__dirstamp) \
    808         SynTree/$(DEPDIR)/$(am__dirstamp)
    809 SynTree/TypeExpr.$(OBJEXT): SynTree/$(am__dirstamp) \
    810         SynTree/$(DEPDIR)/$(am__dirstamp)
    811 SynTree/ApplicationExpr.$(OBJEXT): SynTree/$(am__dirstamp) \
    812         SynTree/$(DEPDIR)/$(am__dirstamp)
    813 SynTree/AddressExpr.$(OBJEXT): SynTree/$(am__dirstamp) \
    814         SynTree/$(DEPDIR)/$(am__dirstamp)
    815 SynTree/Statement.$(OBJEXT): SynTree/$(am__dirstamp) \
    816         SynTree/$(DEPDIR)/$(am__dirstamp)
    817 SynTree/CompoundStmt.$(OBJEXT): SynTree/$(am__dirstamp) \
    818         SynTree/$(DEPDIR)/$(am__dirstamp)
    819 SynTree/DeclStmt.$(OBJEXT): SynTree/$(am__dirstamp) \
    820         SynTree/$(DEPDIR)/$(am__dirstamp)
    821 SynTree/Declaration.$(OBJEXT): SynTree/$(am__dirstamp) \
    822         SynTree/$(DEPDIR)/$(am__dirstamp)
    823 SynTree/DeclarationWithType.$(OBJEXT): SynTree/$(am__dirstamp) \
    824         SynTree/$(DEPDIR)/$(am__dirstamp)
    825 SynTree/ObjectDecl.$(OBJEXT): SynTree/$(am__dirstamp) \
    826         SynTree/$(DEPDIR)/$(am__dirstamp)
    827 SynTree/FunctionDecl.$(OBJEXT): SynTree/$(am__dirstamp) \
    828         SynTree/$(DEPDIR)/$(am__dirstamp)
    829 SynTree/AggregateDecl.$(OBJEXT): SynTree/$(am__dirstamp) \
    830         SynTree/$(DEPDIR)/$(am__dirstamp)
    831 SynTree/NamedTypeDecl.$(OBJEXT): SynTree/$(am__dirstamp) \
    832         SynTree/$(DEPDIR)/$(am__dirstamp)
    833 SynTree/TypeDecl.$(OBJEXT): SynTree/$(am__dirstamp) \
    834         SynTree/$(DEPDIR)/$(am__dirstamp)
    835 SynTree/Initializer.$(OBJEXT): SynTree/$(am__dirstamp) \
    836         SynTree/$(DEPDIR)/$(am__dirstamp)
    837 SynTree/TypeSubstitution.$(OBJEXT): SynTree/$(am__dirstamp) \
    838         SynTree/$(DEPDIR)/$(am__dirstamp)
    839 SynTree/Attribute.$(OBJEXT): SynTree/$(am__dirstamp) \
    840         SynTree/$(DEPDIR)/$(am__dirstamp)
    841 SynTree/DeclReplacer.$(OBJEXT): SynTree/$(am__dirstamp) \
    842         SynTree/$(DEPDIR)/$(am__dirstamp)
    843698CodeGen/$(am__dirstamp):
    844699        @$(MKDIR_P) CodeGen
     
    855710CodeGen/OperatorTable.$(OBJEXT): CodeGen/$(am__dirstamp) \
    856711        CodeGen/$(DEPDIR)/$(am__dirstamp)
     712Concurrency/$(am__dirstamp):
     713        @$(MKDIR_P) Concurrency
     714        @: > Concurrency/$(am__dirstamp)
     715Concurrency/$(DEPDIR)/$(am__dirstamp):
     716        @$(MKDIR_P) Concurrency/$(DEPDIR)
     717        @: > Concurrency/$(DEPDIR)/$(am__dirstamp)
     718Concurrency/Keywords.$(OBJEXT): Concurrency/$(am__dirstamp) \
     719        Concurrency/$(DEPDIR)/$(am__dirstamp)
    857720Common/$(am__dirstamp):
    858721        @$(MKDIR_P) Common
     
    865728Common/Eval.$(OBJEXT): Common/$(am__dirstamp) \
    866729        Common/$(DEPDIR)/$(am__dirstamp)
     730Common/PassVisitor.$(OBJEXT): Common/$(am__dirstamp) \
     731        Common/$(DEPDIR)/$(am__dirstamp)
    867732Common/SemanticError.$(OBJEXT): Common/$(am__dirstamp) \
    868733        Common/$(DEPDIR)/$(am__dirstamp)
     734Common/Stats/$(am__dirstamp):
     735        @$(MKDIR_P) Common/Stats
     736        @: > Common/Stats/$(am__dirstamp)
     737Common/Stats/$(DEPDIR)/$(am__dirstamp):
     738        @$(MKDIR_P) Common/Stats/$(DEPDIR)
     739        @: > Common/Stats/$(DEPDIR)/$(am__dirstamp)
     740Common/Stats/Counter.$(OBJEXT): Common/Stats/$(am__dirstamp) \
     741        Common/Stats/$(DEPDIR)/$(am__dirstamp)
     742Common/Stats/Heap.$(OBJEXT): Common/Stats/$(am__dirstamp) \
     743        Common/Stats/$(DEPDIR)/$(am__dirstamp)
     744Common/Stats/Stats.$(OBJEXT): Common/Stats/$(am__dirstamp) \
     745        Common/Stats/$(DEPDIR)/$(am__dirstamp)
     746Common/Stats/Time.$(OBJEXT): Common/Stats/$(am__dirstamp) \
     747        Common/Stats/$(DEPDIR)/$(am__dirstamp)
    869748Common/UniqueName.$(OBJEXT): Common/$(am__dirstamp) \
    870749        Common/$(DEPDIR)/$(am__dirstamp)
    871 Concurrency/$(am__dirstamp):
    872         @$(MKDIR_P) Concurrency
    873         @: > Concurrency/$(am__dirstamp)
    874 Concurrency/$(DEPDIR)/$(am__dirstamp):
    875         @$(MKDIR_P) Concurrency/$(DEPDIR)
    876         @: > Concurrency/$(DEPDIR)/$(am__dirstamp)
    877 Concurrency/Keywords.$(OBJEXT): Concurrency/$(am__dirstamp) \
    878         Concurrency/$(DEPDIR)/$(am__dirstamp)
    879750ControlStruct/$(am__dirstamp):
    880751        @$(MKDIR_P) ControlStruct
     
    933804ResolvExpr/AlternativeFinder.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
    934805        ResolvExpr/$(DEPDIR)/$(am__dirstamp)
     806ResolvExpr/CastCost.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
     807        ResolvExpr/$(DEPDIR)/$(am__dirstamp)
     808ResolvExpr/CommonType.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
     809        ResolvExpr/$(DEPDIR)/$(am__dirstamp)
     810ResolvExpr/ConversionCost.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
     811        ResolvExpr/$(DEPDIR)/$(am__dirstamp)
     812ResolvExpr/CurrentObject.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
     813        ResolvExpr/$(DEPDIR)/$(am__dirstamp)
    935814ResolvExpr/ExplodedActual.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
    936815        ResolvExpr/$(DEPDIR)/$(am__dirstamp)
    937 ResolvExpr/CastCost.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
    938         ResolvExpr/$(DEPDIR)/$(am__dirstamp)
    939 ResolvExpr/CommonType.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
    940         ResolvExpr/$(DEPDIR)/$(am__dirstamp)
    941 ResolvExpr/ConversionCost.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
    942         ResolvExpr/$(DEPDIR)/$(am__dirstamp)
    943 ResolvExpr/CurrentObject.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
    944         ResolvExpr/$(DEPDIR)/$(am__dirstamp)
    945816ResolvExpr/FindOpenVars.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
    946817        ResolvExpr/$(DEPDIR)/$(am__dirstamp)
     
    967838ResolvExpr/Unify.$(OBJEXT): ResolvExpr/$(am__dirstamp) \
    968839        ResolvExpr/$(DEPDIR)/$(am__dirstamp)
     840SymTab/$(am__dirstamp):
     841        @$(MKDIR_P) SymTab
     842        @: > SymTab/$(am__dirstamp)
     843SymTab/$(DEPDIR)/$(am__dirstamp):
     844        @$(MKDIR_P) SymTab/$(DEPDIR)
     845        @: > SymTab/$(DEPDIR)/$(am__dirstamp)
    969846SymTab/Autogen.$(OBJEXT): SymTab/$(am__dirstamp) \
    970847        SymTab/$(DEPDIR)/$(am__dirstamp)
     
    975852SymTab/Mangler.$(OBJEXT): SymTab/$(am__dirstamp) \
    976853        SymTab/$(DEPDIR)/$(am__dirstamp)
     854SymTab/ManglerCommon.$(OBJEXT): SymTab/$(am__dirstamp) \
     855        SymTab/$(DEPDIR)/$(am__dirstamp)
    977856SymTab/Validate.$(OBJEXT): SymTab/$(am__dirstamp) \
    978857        SymTab/$(DEPDIR)/$(am__dirstamp)
     858SymTab/Demangle.$(OBJEXT): SymTab/$(am__dirstamp) \
     859        SymTab/$(DEPDIR)/$(am__dirstamp)
     860SynTree/$(am__dirstamp):
     861        @$(MKDIR_P) SynTree
     862        @: > SynTree/$(am__dirstamp)
     863SynTree/$(DEPDIR)/$(am__dirstamp):
     864        @$(MKDIR_P) SynTree/$(DEPDIR)
     865        @: > SynTree/$(DEPDIR)/$(am__dirstamp)
     866SynTree/Type.$(OBJEXT): SynTree/$(am__dirstamp) \
     867        SynTree/$(DEPDIR)/$(am__dirstamp)
     868SynTree/VoidType.$(OBJEXT): SynTree/$(am__dirstamp) \
     869        SynTree/$(DEPDIR)/$(am__dirstamp)
     870SynTree/BasicType.$(OBJEXT): SynTree/$(am__dirstamp) \
     871        SynTree/$(DEPDIR)/$(am__dirstamp)
     872SynTree/PointerType.$(OBJEXT): SynTree/$(am__dirstamp) \
     873        SynTree/$(DEPDIR)/$(am__dirstamp)
     874SynTree/ArrayType.$(OBJEXT): SynTree/$(am__dirstamp) \
     875        SynTree/$(DEPDIR)/$(am__dirstamp)
     876SynTree/ReferenceType.$(OBJEXT): SynTree/$(am__dirstamp) \
     877        SynTree/$(DEPDIR)/$(am__dirstamp)
     878SynTree/FunctionType.$(OBJEXT): SynTree/$(am__dirstamp) \
     879        SynTree/$(DEPDIR)/$(am__dirstamp)
     880SynTree/ReferenceToType.$(OBJEXT): SynTree/$(am__dirstamp) \
     881        SynTree/$(DEPDIR)/$(am__dirstamp)
     882SynTree/TupleType.$(OBJEXT): SynTree/$(am__dirstamp) \
     883        SynTree/$(DEPDIR)/$(am__dirstamp)
     884SynTree/TypeofType.$(OBJEXT): SynTree/$(am__dirstamp) \
     885        SynTree/$(DEPDIR)/$(am__dirstamp)
     886SynTree/AttrType.$(OBJEXT): SynTree/$(am__dirstamp) \
     887        SynTree/$(DEPDIR)/$(am__dirstamp)
     888SynTree/VarArgsType.$(OBJEXT): SynTree/$(am__dirstamp) \
     889        SynTree/$(DEPDIR)/$(am__dirstamp)
     890SynTree/ZeroOneType.$(OBJEXT): SynTree/$(am__dirstamp) \
     891        SynTree/$(DEPDIR)/$(am__dirstamp)
     892SynTree/Constant.$(OBJEXT): SynTree/$(am__dirstamp) \
     893        SynTree/$(DEPDIR)/$(am__dirstamp)
     894SynTree/Expression.$(OBJEXT): SynTree/$(am__dirstamp) \
     895        SynTree/$(DEPDIR)/$(am__dirstamp)
     896SynTree/TupleExpr.$(OBJEXT): SynTree/$(am__dirstamp) \
     897        SynTree/$(DEPDIR)/$(am__dirstamp)
     898SynTree/CommaExpr.$(OBJEXT): SynTree/$(am__dirstamp) \
     899        SynTree/$(DEPDIR)/$(am__dirstamp)
     900SynTree/TypeExpr.$(OBJEXT): SynTree/$(am__dirstamp) \
     901        SynTree/$(DEPDIR)/$(am__dirstamp)
     902SynTree/ApplicationExpr.$(OBJEXT): SynTree/$(am__dirstamp) \
     903        SynTree/$(DEPDIR)/$(am__dirstamp)
     904SynTree/AddressExpr.$(OBJEXT): SynTree/$(am__dirstamp) \
     905        SynTree/$(DEPDIR)/$(am__dirstamp)
     906SynTree/Statement.$(OBJEXT): SynTree/$(am__dirstamp) \
     907        SynTree/$(DEPDIR)/$(am__dirstamp)
     908SynTree/CompoundStmt.$(OBJEXT): SynTree/$(am__dirstamp) \
     909        SynTree/$(DEPDIR)/$(am__dirstamp)
     910SynTree/DeclStmt.$(OBJEXT): SynTree/$(am__dirstamp) \
     911        SynTree/$(DEPDIR)/$(am__dirstamp)
     912SynTree/Declaration.$(OBJEXT): SynTree/$(am__dirstamp) \
     913        SynTree/$(DEPDIR)/$(am__dirstamp)
     914SynTree/DeclarationWithType.$(OBJEXT): SynTree/$(am__dirstamp) \
     915        SynTree/$(DEPDIR)/$(am__dirstamp)
     916SynTree/ObjectDecl.$(OBJEXT): SynTree/$(am__dirstamp) \
     917        SynTree/$(DEPDIR)/$(am__dirstamp)
     918SynTree/FunctionDecl.$(OBJEXT): SynTree/$(am__dirstamp) \
     919        SynTree/$(DEPDIR)/$(am__dirstamp)
     920SynTree/AggregateDecl.$(OBJEXT): SynTree/$(am__dirstamp) \
     921        SynTree/$(DEPDIR)/$(am__dirstamp)
     922SynTree/NamedTypeDecl.$(OBJEXT): SynTree/$(am__dirstamp) \
     923        SynTree/$(DEPDIR)/$(am__dirstamp)
     924SynTree/TypeDecl.$(OBJEXT): SynTree/$(am__dirstamp) \
     925        SynTree/$(DEPDIR)/$(am__dirstamp)
     926SynTree/Initializer.$(OBJEXT): SynTree/$(am__dirstamp) \
     927        SynTree/$(DEPDIR)/$(am__dirstamp)
     928SynTree/TypeSubstitution.$(OBJEXT): SynTree/$(am__dirstamp) \
     929        SynTree/$(DEPDIR)/$(am__dirstamp)
     930SynTree/Attribute.$(OBJEXT): SynTree/$(am__dirstamp) \
     931        SynTree/$(DEPDIR)/$(am__dirstamp)
     932SynTree/DeclReplacer.$(OBJEXT): SynTree/$(am__dirstamp) \
     933        SynTree/$(DEPDIR)/$(am__dirstamp)
    979934Tuples/$(am__dirstamp):
    980935        @$(MKDIR_P) Tuples
     
    983938        @$(MKDIR_P) Tuples/$(DEPDIR)
    984939        @: > Tuples/$(DEPDIR)/$(am__dirstamp)
    985 Tuples/Explode.$(OBJEXT): Tuples/$(am__dirstamp) \
    986         Tuples/$(DEPDIR)/$(am__dirstamp)
    987940Tuples/TupleAssignment.$(OBJEXT): Tuples/$(am__dirstamp) \
    988941        Tuples/$(DEPDIR)/$(am__dirstamp)
    989942Tuples/TupleExpansion.$(OBJEXT): Tuples/$(am__dirstamp) \
     943        Tuples/$(DEPDIR)/$(am__dirstamp)
     944Tuples/Explode.$(OBJEXT): Tuples/$(am__dirstamp) \
    990945        Tuples/$(DEPDIR)/$(am__dirstamp)
    991946Validate/$(am__dirstamp):
     
    10701025        Concurrency/$(DEPDIR)/$(am__dirstamp)
    10711026Common/DebugMalloc.$(OBJEXT): Common/$(am__dirstamp) \
    1072         Common/$(DEPDIR)/$(am__dirstamp)
    1073 Common/Heap.$(OBJEXT): Common/$(am__dirstamp) \
    10741027        Common/$(DEPDIR)/$(am__dirstamp)
    10751028ControlStruct/ExceptTranslate.$(OBJEXT):  \
     
    11421095        -rm -f CodeTools/*.$(OBJEXT)
    11431096        -rm -f Common/*.$(OBJEXT)
     1097        -rm -f Common/Stats/*.$(OBJEXT)
    11441098        -rm -f Concurrency/*.$(OBJEXT)
    11451099        -rm -f ControlStruct/*.$(OBJEXT)
     
    11721126@AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/DebugMalloc.Po@am__quote@
    11731127@AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/Eval.Po@am__quote@
    1174 @AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/Heap.Po@am__quote@
     1128@AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/PassVisitor.Po@am__quote@
    11751129@AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/SemanticError.Po@am__quote@
    11761130@AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/UniqueName.Po@am__quote@
     1131@AMDEP_TRUE@@am__include@ @am__quote@Common/Stats/$(DEPDIR)/Counter.Po@am__quote@
     1132@AMDEP_TRUE@@am__include@ @am__quote@Common/Stats/$(DEPDIR)/Heap.Po@am__quote@
     1133@AMDEP_TRUE@@am__include@ @am__quote@Common/Stats/$(DEPDIR)/Stats.Po@am__quote@
     1134@AMDEP_TRUE@@am__include@ @am__quote@Common/Stats/$(DEPDIR)/Time.Po@am__quote@
    11771135@AMDEP_TRUE@@am__include@ @am__quote@Concurrency/$(DEPDIR)/Keywords.Po@am__quote@
    11781136@AMDEP_TRUE@@am__include@ @am__quote@Concurrency/$(DEPDIR)/Waitfor.Po@am__quote@
     
    14361394        -rm -f Common/$(DEPDIR)/$(am__dirstamp)
    14371395        -rm -f Common/$(am__dirstamp)
     1396        -rm -f Common/Stats/$(DEPDIR)/$(am__dirstamp)
     1397        -rm -f Common/Stats/$(am__dirstamp)
    14381398        -rm -f Concurrency/$(DEPDIR)/$(am__dirstamp)
    14391399        -rm -f Concurrency/$(am__dirstamp)
     
    14731433
    14741434distclean: distclean-am
    1475         -rm -rf ./$(DEPDIR) CodeGen/$(DEPDIR) CodeTools/$(DEPDIR) Common/$(DEPDIR) Concurrency/$(DEPDIR) ControlStruct/$(DEPDIR) GenPoly/$(DEPDIR) InitTweak/$(DEPDIR) Parser/$(DEPDIR) ResolvExpr/$(DEPDIR) SymTab/$(DEPDIR) SynTree/$(DEPDIR) Tuples/$(DEPDIR) Validate/$(DEPDIR) Virtual/$(DEPDIR)
     1435        -rm -rf ./$(DEPDIR) CodeGen/$(DEPDIR) CodeTools/$(DEPDIR) Common/$(DEPDIR) Common/Stats/$(DEPDIR) Concurrency/$(DEPDIR) ControlStruct/$(DEPDIR) GenPoly/$(DEPDIR) InitTweak/$(DEPDIR) Parser/$(DEPDIR) ResolvExpr/$(DEPDIR) SymTab/$(DEPDIR) SynTree/$(DEPDIR) Tuples/$(DEPDIR) Validate/$(DEPDIR) Virtual/$(DEPDIR)
    14761436        -rm -f Makefile
    14771437distclean-am: clean-am distclean-compile distclean-generic \
     
    15191479
    15201480maintainer-clean: maintainer-clean-am
    1521         -rm -rf ./$(DEPDIR) CodeGen/$(DEPDIR) CodeTools/$(DEPDIR) Common/$(DEPDIR) Concurrency/$(DEPDIR) ControlStruct/$(DEPDIR) GenPoly/$(DEPDIR) InitTweak/$(DEPDIR) Parser/$(DEPDIR) ResolvExpr/$(DEPDIR) SymTab/$(DEPDIR) SynTree/$(DEPDIR) Tuples/$(DEPDIR) Validate/$(DEPDIR) Virtual/$(DEPDIR)
     1481        -rm -rf ./$(DEPDIR) CodeGen/$(DEPDIR) CodeTools/$(DEPDIR) Common/$(DEPDIR) Common/Stats/$(DEPDIR) Concurrency/$(DEPDIR) ControlStruct/$(DEPDIR) GenPoly/$(DEPDIR) InitTweak/$(DEPDIR) Parser/$(DEPDIR) ResolvExpr/$(DEPDIR) SymTab/$(DEPDIR) SynTree/$(DEPDIR) Tuples/$(DEPDIR) Validate/$(DEPDIR) Virtual/$(DEPDIR)
    15221482        -rm -f Makefile
    15231483maintainer-clean-am: distclean-am maintainer-clean-generic
     
    15591519
    15601520
     1521$(addprefix $(srcdir)/, ResolvExpr/ConversionCost.cc ResolvExpr/CommonType.cc SymTab/ManglerCommon.cc) : $(srcdir)/SynTree/Type.h
     1522
     1523$(srcdir)/SynTree/Type.h : BasicTypes-gen.cc
     1524        ${AM_V_GEN}${CXXCOMPILE} $< -o BasicTypes-gen -Wall -Wextra
     1525        @./BasicTypes-gen
     1526        @rm BasicTypes-gen
     1527
    15611528# Tell versions [3.59,3.63) of GNU make to not export all variables.
    15621529# Otherwise a system limit (for SysV at least) may be exceeded.
  • src/Parser/DeclarationNode.cc

    r9d9a451 r53bb8f1  
    1010// Created On       : Sat May 16 12:34:05 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Nov  1 20:54:26 2018
    13 // Update Count     : 1108
     12// Last Modified On : Fri Feb  1 16:49:17 2019
     13// Update Count     : 1113
    1414//
    1515
     
    4141
    4242// These must harmonize with the corresponding DeclarationNode enumerations.
    43 const char * DeclarationNode::basicTypeNames[] = { "void", "_Bool", "char", "int", "float", "double", "long double", "int128", "float80", "float128", "NoBasicTypeNames" };
    44 const char * DeclarationNode::complexTypeNames[] = { "_Complex", "_Imaginary", "NoComplexTypeNames" };
     43const char * DeclarationNode::basicTypeNames[] = { "void", "_Bool", "char", "int", "int128",
     44                                                                                                   "float", "double", "long double", "float80", "float128",
     45                                                                                                   "_float16", "_float32", "_float32x", "_float64", "_float64x", "_float128", "_float128x", "NoBasicTypeNames" };
     46const char * DeclarationNode::complexTypeNames[] = { "_Complex", "NoComplexTypeNames", "_Imaginary" }; // Imaginary unsupported => parse, but make invisible and print error message
    4547const char * DeclarationNode::signednessNames[] = { "signed", "unsigned", "NoSignednessNames" };
    4648const char * DeclarationNode::lengthNames[] = { "short", "long", "long long", "NoLengthNames" };
  • src/Parser/ExpressionNode.cc

    r9d9a451 r53bb8f1  
    1010// Created On       : Sat May 16 13:17:07 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Jun  4 21:24:45 2018
    13 // Update Count     : 802
     12// Last Modified On : Sun Mar 10 16:10:32 2019
     13// Update Count     : 976
    1414//
    1515
     
    5151extern const Type::Qualifiers noQualifiers;                             // no qualifiers on constants
    5252
    53 static inline bool checkH( char c ) { return c == 'h' || c == 'H'; }
    54 static inline bool checkL( char c ) { return c == 'l' || c == 'L'; }
    55 static inline bool checkZ( char c ) { return c == 'z' || c == 'Z'; }
    56 static inline bool checkU( char c ) { return c == 'u' || c == 'U'; }
     53// static inline bool checkH( char c ) { return c == 'h' || c == 'H'; }
     54// static inline bool checkZ( char c ) { return c == 'z' || c == 'Z'; }
     55// static inline bool checkU( char c ) { return c == 'u' || c == 'U'; }
    5756static inline bool checkF( char c ) { return c == 'f' || c == 'F'; }
    5857static inline bool checkD( char c ) { return c == 'd' || c == 'D'; }
     58static inline bool checkF80( char c ) { return c == 'w' || c == 'W'; }
     59static inline bool checkF128( char c ) { return c == 'q' || c == 'Q'; }
     60static inline bool checkL( char c ) { return c == 'l' || c == 'L'; }
    5961static inline bool checkI( char c ) { return c == 'i' || c == 'I'; }
    6062static inline bool checkB( char c ) { return c == 'b' || c == 'B'; }
    6163static inline bool checkX( char c ) { return c == 'x' || c == 'X'; }
    62 
    63 static const char * lnthsInt[2][6] = {
    64         { "int8_t", "int16_t", "int32_t", "int64_t", "size_t", },
    65         { "uint8_t", "uint16_t", "uint32_t", "uint64_t", "size_t", }
    66 }; // lnthsInt
    67 
    68 static inline void checkLNInt( string & str, int & lnth, int & size ) {
    69         string::size_type posn = str.find_first_of( "lL" ), start = posn;
    70   if ( posn == string::npos ) return;
    71         size = 4;                                                                                       // assume largest size
    72         posn += 1;                                                                                      // advance to size
    73         if ( str[posn] == '8' ) {                                                       // 8
    74                 lnth = 0;
    75         } else if ( str[posn] == '1' ) {
    76                 posn += 1;
    77                 if ( str[posn] == '6' ) {                                               // 16
    78                         lnth = 1;
     64static inline bool checkN( char c ) { return c == 'n' || c == 'N'; }
     65
     66void lnthSuffix( string & str, int & type, int & ltype ) {
     67        string::size_type posn = str.find_last_of( "lL" );
     68
     69        if ( posn == string::npos ) return;                                     // no suffix
     70        if ( posn == str.length() - 1 ) { type = 3; return; } // no length => long
     71
     72        string::size_type next = posn + 1;                                      // advance to length
     73        if ( str[next] == '3' ) {                                                       // 32
     74                type = ltype = 2;
     75        } else if ( str[next] == '6' ) {                                        // 64
     76                type = ltype = 3;
     77        } else if ( str[next] == '8' ) {                                        // 8
     78                type = ltype = 1;
     79        } else if ( str[next] == '1' ) {
     80                if ( str[next + 1] == '6' ) {                                   // 16
     81                        type = ltype = 0;
    7982                } else {                                                                                // 128
    80                         posn += 1;
    81                         lnth = 5;
    82                 } // if
    83         } else {
    84                 if ( str[posn] == '3' ) {                                               // 32
    85                         lnth = 2;
    86                 } else if ( str[posn] == '6' ) {                                // 64
    87                         lnth = 3;
    88                 } else {
    89                         assertf( false, "internal error, bad integral length %s", str.c_str() );
    90                 } // if
    91                 posn += 1;
    92         } // if
    93         str.erase( start, posn - start + 1 );                           // remove length suffix
    94 } // checkLNInt
     83                        type = 5; ltype = 6;
     84                } // if
     85        } // if
     86        // remove "lL" for these cases because it may not imply long
     87        str.erase( posn );                                                                      // remove length
     88} // lnthSuffix
     89
     90void valueToType( unsigned long long int & v, bool dec, int & type, bool & Unsigned ) {
     91        // use value to determine type
     92        if ( v <= INT_MAX ) {                                                           // signed int
     93                type = 2;
     94        } else if ( v <= UINT_MAX && ! dec ) {                          // unsigned int
     95                type = 2;
     96                Unsigned = true;                                                                // unsigned
     97        } else if ( v <= LONG_MAX ) {                                           // signed long int
     98                type = 3;
     99        } else if ( v <= ULONG_MAX && ( ! dec || LONG_MAX == LLONG_MAX ) ) { // signed long int
     100                type = 3;
     101                Unsigned = true;                                                                // unsigned long int
     102        } else if ( v <= LLONG_MAX ) {                                          // signed long long int
     103                type = 4;
     104        } else {                                                                                        // unsigned long long int
     105                type = 4;
     106                Unsigned = true;                                                                // unsigned long long int
     107        } // if
     108} // valueToType
    95109
    96110Expression * build_constantInteger( string & str ) {
    97         static const BasicType::Kind kind[2][6] = {
    98                 // short (h) must be before char (hh)
     111        static const BasicType::Kind kind[2][7] = {
     112                // short (h) must be before char (hh) because shorter type has the longer suffix
    99113                { BasicType::ShortSignedInt, BasicType::SignedChar, BasicType::SignedInt, BasicType::LongSignedInt, BasicType::LongLongSignedInt, BasicType::SignedInt128, },
    100114                { BasicType::ShortUnsignedInt, BasicType::UnsignedChar, BasicType::UnsignedInt, BasicType::LongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::UnsignedInt128, },
    101115        };
    102116
    103         bool dec = true, Unsigned = false;                                      // decimal, unsigned constant
    104         int size;                                                                                       // 0 => short, 1 => char, 2 => int, 3 => long int, 4 => long long int, 5 => int128
    105         int lnth = -1;                                                                          // literal length
     117        static const char * lnthsInt[2][6] = {
     118                { "int16_t",  "int8_t",  "int32_t",  "int64_t",  "size_t",  "uintptr_t", },
     119                { "uint16_t", "uint8_t", "uint32_t", "uint64_t", "size_t",  "uintptr_t", },
     120        }; // lnthsInt
    106121
    107122        unsigned long long int v;                                                       // converted integral value
    108123        size_t last = str.length() - 1;                                         // last subscript of constant
    109124        Expression * ret;
     125        //string fred( str );
     126
     127        int type = -1;                                                                          // 0 => short, 1 => char, 2 => int, 3 => long int, 4 => long long int, 5 => int128
     128        int ltype = -1;                                                                         // 0 => 16 bits, 1 => 8 bits, 2 => 32 bits, 3 => 64 bits, 4 => size_t, 5 => intptr, 6 => pointer
     129        bool dec = true, Unsigned = false;                                      // decimal, unsigned constant
    110130
    111131        // special constants
     
    119139        } // if
    120140
    121         // Cannot be "0"
     141        // Cannot be just "0"/"1"; sscanf stops at the suffix, if any; value goes over the wall => always generate
    122142
    123143        if ( str[0] == '0' ) {                                                          // radix character ?
     
    127147                        //printf( "%llx %llu\n", v, v );
    128148                } else if ( checkB( str[1] ) ) {                                // binary constant ?
    129                         v = 0;
    130                         for ( unsigned int i = 2;; i += 1 ) {           // compute value
     149                        v = 0;                                                                          // compute value
     150                        for ( unsigned int i = 2;; ) {                          // ignore prefix
    131151                                if ( str[i] == '1' ) v |= 1;
    132                           if ( i == last ) break;
     152                                i += 1;
     153                          if ( i == last - 1 || (str[i] != '0' && str[i] != '1') ) break;
    133154                                v <<= 1;
    134155                        } // for
    135                         //printf( "%llx %llu\n", v, v );
     156                        //printf( "%#llx %llu\n", v, v );
    136157                } else {                                                                                // octal constant
    137158                        sscanf( (char *)str.c_str(), "%llo", &v );
    138                         //printf( "%llo %llu\n", v, v );
     159                        //printf( "%#llo %llu\n", v, v );
    139160                } // if
    140161        } else {                                                                                        // decimal constant ?
    141162                sscanf( (char *)str.c_str(), "%llu", &v );
    142                 //printf( "%llu %llu\n", v, v );
    143         } // if
    144 
    145         if ( v <= INT_MAX ) {                                                           // signed int
    146                 size = 2;
    147         } else if ( v <= UINT_MAX && ! dec ) {                          // unsigned int
    148                 size = 2;
    149                 Unsigned = true;                                                                // unsigned
    150         } else if ( v <= LONG_MAX ) {                                           // signed long int
    151                 size = 3;
    152         } else if ( v <= ULONG_MAX && ( ! dec || LONG_MAX == LLONG_MAX ) ) { // signed long int
    153                 size = 3;
    154                 Unsigned = true;                                                                // unsigned long int
    155         } else if ( v <= LLONG_MAX ) {                                          // signed long long int
    156                 size = 4;
    157         } else {                                                                                        // unsigned long long int
    158                 size = 4;
    159                 Unsigned = true;                                                                // unsigned long long int
    160         } // if
    161 
    162         // At least one digit in integer constant, so safe to backup while looking for suffix.
    163 
    164         if ( checkU( str[last] ) ) {                                            // suffix 'u' ?
    165                 Unsigned = true;
    166                 if ( checkL( str[last - 1] ) ) {                                // suffix 'l' ?
    167                         size = 3;
    168                         if ( checkL( str[last - 2] ) ) {                        // suffix "ll" ?
    169                                 size = 4;
     163                //printf( "%llu\n", v );
     164        } // if
     165
     166        string::size_type posn;
     167
     168        if ( isdigit( str[last] ) ) {                                           // no suffix ?
     169                lnthSuffix( str, type, ltype );                                 // could have length suffix
     170                if ( type == -1 ) {                                                             // no suffix
     171                        valueToType( v, dec, type, Unsigned );
     172                } // if
     173        } else {
     174                // At least one digit in integer constant, so safe to backup while looking for suffix.
     175
     176                posn = str.find_last_of( "pP" );
     177                if ( posn != string::npos ) { valueToType( v, dec, type, Unsigned ); ltype = 5; str.erase( posn, 1 ); goto FINI; }
     178
     179                posn = str.find_last_of( "zZ" );
     180                if ( posn != string::npos ) { Unsigned = true; type = 2; ltype = 4; str.erase( posn, 1 ); goto FINI; }
     181
     182                // 'u' can appear before or after length suffix
     183                if ( str.find_last_of( "uU" ) != string::npos ) Unsigned = true;
     184
     185                posn = str.rfind( "hh" );
     186                if ( posn != string::npos ) { type = 1; str.erase( posn, 2 ); goto FINI; }
     187
     188                posn = str.rfind( "HH" );
     189                if ( posn != string::npos ) { type = 1; str.erase( posn, 2 ); goto FINI; }
     190
     191                posn = str.find_last_of( "hH" );
     192                if ( posn != string::npos ) { type = 0; str.erase( posn, 1 ); goto FINI; }
     193
     194                posn = str.find_last_of( "nN" );
     195                if ( posn != string::npos ) { type = 2; str.erase( posn, 1 ); goto FINI; }
     196
     197                if ( str.rfind( "ll" ) != string::npos || str.rfind( "LL" ) != string::npos ) { type = 4; goto FINI; }
     198
     199                lnthSuffix( str, type, ltype );                                 // must be after check for "ll"
     200                if ( type == -1 ) {                                                             // only 'u' suffix ?
     201                        valueToType( v, dec, type, Unsigned );
     202                } // if
     203          FINI: ;
     204        } // if
     205
     206        //if ( !( 0 <= type && type <= 6 ) ) { printf( "%s %lu %d %s\n", fred.c_str(), fred.length(), type, str.c_str() ); }
     207        assert( 0 <= type && type <= 6 );
     208
     209        // Constant type is correct for overload resolving.
     210        ret = new ConstantExpr( Constant( new BasicType( noQualifiers, kind[Unsigned][type] ), str, v ) );
     211        if ( Unsigned && type < 2 ) {                                           // hh or h, less than int ?
     212                // int i = -1uh => 65535 not -1, so cast is necessary for unsigned, which unfortunately eliminates warnings for large values.
     213                ret = new CastExpr( ret, new BasicType( Type::Qualifiers(), kind[Unsigned][type] ), false );
     214        } else if ( ltype != -1 ) {                                                     // explicit length ?
     215                if ( ltype == 6 ) {                                                             // int128, (int128)constant
     216                        ret = new CastExpr( ret, new BasicType( Type::Qualifiers(), kind[Unsigned][type] ), false );
     217                } else {                                                                                // explicit length, (length_type)constant
     218                        ret = new CastExpr( ret, new TypeInstType( Type::Qualifiers(), lnthsInt[Unsigned][ltype], false ), false );
     219                        if ( ltype == 5 ) {                                                     // pointer, intptr( (uintptr_t)constant )
     220                                ret = build_func( new ExpressionNode( build_varref( new string( "intptr" ) ) ), new ExpressionNode( ret ) );                                                             
    170221                        } // if
    171                 } else if ( checkH( str[last - 1] ) ) {                 // suffix 'h' ?
    172                         size = 0;
    173                         if ( checkH( str[last - 2] ) ) {                        // suffix "hh" ?
    174                                 size = 1;
    175                         } // if
    176                         str.erase( last - size - 1, size + 1 );         // remove 'h'/"hh"
    177                 } else {                                                                                // suffix "ln" ?
    178                         checkLNInt( str, lnth, size );
    179                 } // if
    180         } else if ( checkL( str[ last ] ) ) {                           // suffix 'l' ?
    181                 size = 3;
    182                 if ( checkL( str[last - 1] ) ) {                                // suffix 'll' ?
    183                         size = 4;
    184                         if ( checkU( str[last - 2] ) ) {                        // suffix 'u' ?
    185                                 Unsigned = true;
    186                         } // if
    187                 } else if ( checkU( str[last - 1] ) ) {                 // suffix 'u' ?
    188                         Unsigned = true;
    189                 } // if
    190         } else if ( checkH( str[ last ] ) ) {                           // suffix 'h' ?
    191                 size = 0;
    192                 if ( checkH( str[last - 1] ) ) {                                // suffix "hh" ?
    193                         size = 1;
    194                         if ( checkU( str[last - 2] ) ) {                        // suffix 'u' ?
    195                                 Unsigned = true;
    196                         } // if
    197                 } else if ( checkU( str[last - 1] ) ) {                 // suffix 'u' ?
    198                         Unsigned = true;
    199                 } // if
    200                 str.erase( last - size, size + 1 );                             // remove 'h'/"hh"
    201         } else if ( checkZ( str[last] ) ) {                                     // suffix 'z' ?
    202                 lnth = 4;
    203                 str.erase( last, 1 );                                                   // remove 'z'
    204         } else {                                                                                        // suffix "ln" ?
    205                 checkLNInt( str, lnth, size );
    206         } // if
    207 
    208         assert( 0 <= size && size < 6 );
    209         // Constant type is correct for overload resolving.
    210         ret = new ConstantExpr( Constant( new BasicType( noQualifiers, kind[Unsigned][size] ), str, v ) );
    211         if ( Unsigned && size < 2 ) {                                           // hh or h, less than int ?
    212                 // int i = -1uh => 65535 not -1, so cast is necessary for unsigned, which unfortunately eliminates warnings for large values.
    213                 ret = new CastExpr( ret, new BasicType( Type::Qualifiers(), kind[Unsigned][size] ), false );
    214         } else if ( lnth != -1 ) {                                                      // explicit length ?
    215                 if ( lnth == 5 ) {                                                              // int128 ?
    216                         size = 5;
    217                         ret = new CastExpr( ret, new BasicType( Type::Qualifiers(), kind[Unsigned][size] ), false );
    218                 } else {
    219                         ret = new CastExpr( ret, new TypeInstType( Type::Qualifiers(), lnthsInt[Unsigned][lnth], false ), false );
    220                 } // if
    221         } // if
    222   CLEANUP:
    223 
     222                } // if
     223        } // if
     224
     225  CLEANUP: ;
    224226        delete &str;                                                                            // created by lex
    225227        return ret;
     
    227229
    228230
    229 static inline void checkLNFloat( string & str, int & lnth, int & size ) {
    230         string::size_type posn = str.find_first_of( "lL" ), start = posn;
     231static inline void checkFnxFloat( string & str, size_t last, bool & explnth, int & type ) {
     232        string::size_type posn;
     233        // floating-point constant has minimum of 2 characters, 1. or .1, so safe to look ahead
     234        if ( str[1] == 'x' ) {                                                          // hex ?
     235                posn = str.find_last_of( "pP" );                                // back for exponent (must have)
     236                posn = str.find_first_of( "fF", posn + 1 );             // forward for size (fF allowed in hex constant)
     237        } else {
     238                posn = str.find_last_of( "fF" );                                // back for size (fF not allowed)
     239        } // if
    231240  if ( posn == string::npos ) return;
    232         size = 2;                                                                                       // assume largest size
    233         lnth = 0;
     241        explnth = true;
    234242        posn += 1;                                                                                      // advance to size
    235243        if ( str[posn] == '3' ) {                                                       // 32
    236                 size = 0;
     244                if ( str[last] != 'x' ) type = 6;
     245                else type = 7;
    237246        } else if ( str[posn] == '6' ) {                                        // 64
    238                 size = 1;
    239         } else if ( str[posn] == '8' || str[posn] == '1' ) { // 80, 128
    240                 size = 2;
    241                 if ( str[posn] == '1' ) posn += 1;
     247                if ( str[last] != 'x' ) type = 8;
     248                else type = 9;
     249        } else if ( str[posn] == '8' ) {                                        // 80
     250                type = 3;
     251        } else if ( str[posn] == '1' ) {                                        // 16/128
     252                if ( str[posn + 1] == '6' ) {                                   // 16
     253                        type = 5;
     254                } else {                                                                                // 128
     255                        if ( str[last] != 'x' ) type = 10;
     256                        else type = 11;
     257                } // if
    242258        } else {
    243259                assertf( false, "internal error, bad floating point length %s", str.c_str() );
    244260        } // if
    245         posn += 1;
    246         str.erase( start, posn - start + 1 );                           // remove length suffix
    247 } // checkLNFloat
     261} // checkFnxFloat
    248262
    249263
    250264Expression * build_constantFloat( string & str ) {
    251         static const BasicType::Kind kind[2][3] = {
    252                 { BasicType::Float, BasicType::Double, BasicType::LongDouble },
    253                 { BasicType::FloatComplex, BasicType::DoubleComplex, BasicType::LongDoubleComplex },
     265        static const BasicType::Kind kind[2][12] = {
     266                { BasicType::Float, BasicType::Double, BasicType::LongDouble, BasicType::uuFloat80, BasicType::uuFloat128, BasicType::uFloat16, BasicType::uFloat32, BasicType::uFloat32x, BasicType::uFloat64, BasicType::uFloat64x, BasicType::uFloat128, BasicType::uFloat128x },
     267                { BasicType::FloatComplex, BasicType::DoubleComplex, BasicType::LongDoubleComplex, (BasicType::Kind)-1, (BasicType::Kind)-1, BasicType::uFloat16Complex, BasicType::uFloat32Complex, BasicType::uFloat32xComplex, BasicType::uFloat64Complex, BasicType::uFloat64xComplex, BasicType::uFloat128Complex, BasicType::uFloat128xComplex },
    254268        };
    255269
    256         bool complx = false;                                                            // real, complex
    257         int size = 1;                                                                           // 0 => float, 1 => double, 2 => long double
    258         int lnth = -1;                                                                          // literal length
    259         // floating-point constant has minimum of 2 characters: 1. or .1
     270        // floating-point constant has minimum of 2 characters 1. or .1
    260271        size_t last = str.length() - 1;
    261272        double v;
     273        int type;                                                                                       // 0 => float, 1 => double, 3 => long double, ...
     274        bool complx = false;                                                            // real, complex
     275        bool explnth = false;                                                           // explicit literal length
    262276
    263277        sscanf( str.c_str(), "%lg", &v );
     
    269283
    270284        if ( checkF( str[last] ) ) {                                            // float ?
    271                 size = 0;
     285                type = 0;
    272286        } else if ( checkD( str[last] ) ) {                                     // double ?
    273                 size = 1;
     287                type = 1;
    274288        } else if ( checkL( str[last] ) ) {                                     // long double ?
    275                 size = 2;
     289                type = 2;
     290        } else if ( checkF80( str[last] ) ) {                           // __float80 ?
     291                type = 3;
     292        } else if ( checkF128( str[last] ) ) {                          // __float128 ?
     293                type = 4;
    276294        } else {
    277                 size = 1;                                                                               // double (default)
    278                 checkLNFloat( str, lnth, size );
    279         } // if
     295                type = 1;                                                                               // double (default if no suffix)
     296                checkFnxFloat( str, last, explnth, type );
     297        } // if
     298
    280299        if ( ! complx && checkI( str[last - 1] ) ) {            // imaginary ?
    281300                complx = true;
    282301        } // if
    283302
    284         assert( 0 <= size && size < 3 );
    285         Expression * ret = new ConstantExpr( Constant( new BasicType( noQualifiers, kind[complx][size] ), str, v ) );
    286         if ( lnth != -1 ) {                                                                     // explicit length ?
    287                 ret = new CastExpr( ret, new BasicType( Type::Qualifiers(), kind[complx][size] ), false );
     303        assert( 0 <= type && type < 12 );
     304        Expression * ret = new ConstantExpr( Constant( new BasicType( noQualifiers, kind[complx][type] ), str, v ) );
     305        if ( explnth ) {                                                                        // explicit length ?
     306                ret = new CastExpr( ret, new BasicType( Type::Qualifiers(), kind[complx][type] ), false );
    288307        } // if
    289308
  • src/Parser/ParseNode.h

    r9d9a451 r53bb8f1  
    1010// Created On       : Sat May 16 13:28:16 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Nov  1 20:54:53 2018
    13 // Update Count     : 854
     12// Last Modified On : Wed Feb 13 17:36:49 2019
     13// Update Count     : 867
    1414//
    1515
     
    206206class DeclarationNode : public ParseNode {
    207207  public:
    208         // These enumerations must harmonize with their names.
    209         enum BasicType { Void, Bool, Char, Int, Float, Double, LongDouble, Int128, Float80, Float128, NoBasicType };
     208        // These enumerations must harmonize with their names in DeclarationNode.cc.
     209        enum BasicType { Void, Bool, Char, Int, Int128,
     210                                         Float, Double, LongDouble, uuFloat80, uuFloat128,
     211                                         uFloat16, uFloat32, uFloat32x, uFloat64, uFloat64x, uFloat128, uFloat128x, NoBasicType };
    210212        static const char * basicTypeNames[];
    211         enum ComplexType { Complex, Imaginary, NoComplexType };
     213        enum ComplexType { Complex, NoComplexType, Imaginary }; // Imaginary unsupported => parse, but make invisible and print error message
    212214        static const char * complexTypeNames[];
    213215        enum Signedness { Signed, Unsigned, NoSignedness };
  • src/Parser/TypeData.cc

    r9d9a451 r53bb8f1  
    1010// Created On       : Sat May 16 15:12:51 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Nov  2 07:54:26 2018
    13 // Update Count     : 624
     12// Last Modified On : Wed Feb 13 18:16:23 2019
     13// Update Count     : 649
    1414//
    1515
     
    666666
    667667          case DeclarationNode::Float:
    668           case DeclarationNode::Float80:
    669           case DeclarationNode::Float128:
    670668          case DeclarationNode::Double:
    671669          case DeclarationNode::LongDouble:                                     // not set until below
    672                 static BasicType::Kind floattype[3][3] = {
    673                         { BasicType::FloatComplex, BasicType::DoubleComplex, BasicType::LongDoubleComplex },
    674                         { BasicType::FloatImaginary, BasicType::DoubleImaginary, BasicType::LongDoubleImaginary },
    675                         { BasicType::Float, BasicType::Double, BasicType::LongDouble },
     670          case DeclarationNode::uuFloat80:
     671          case DeclarationNode::uuFloat128:
     672          case DeclarationNode::uFloat16:
     673          case DeclarationNode::uFloat32:
     674          case DeclarationNode::uFloat32x:
     675          case DeclarationNode::uFloat64:
     676          case DeclarationNode::uFloat64x:
     677          case DeclarationNode::uFloat128:
     678          case DeclarationNode::uFloat128x:
     679                static BasicType::Kind floattype[2][12] = {
     680                        { BasicType::FloatComplex, BasicType::DoubleComplex, BasicType::LongDoubleComplex, (BasicType::Kind)-1, (BasicType::Kind)-1, BasicType::uFloat16Complex, BasicType::uFloat32Complex, BasicType::uFloat32xComplex, BasicType::uFloat64Complex, BasicType::uFloat64xComplex, BasicType::uFloat128Complex, BasicType::uFloat128xComplex, },
     681                        { BasicType::Float, BasicType::Double, BasicType::LongDouble, BasicType::uuFloat80, BasicType::uuFloat128, BasicType::uFloat16, BasicType::uFloat32, BasicType::uFloat32x, BasicType::uFloat64, BasicType::uFloat64x, BasicType::uFloat128, BasicType::uFloat128x, },
    676682                };
    677683
     
    686692                        genTSError( DeclarationNode::lengthNames[ td->length ], td->basictype );
    687693                } // if
     694                if ( td->complextype == DeclarationNode::Imaginary ) {
     695                        genTSError( DeclarationNode::complexTypeNames[ td->complextype ], td->basictype );
     696                } // if
     697                if ( (td->basictype == DeclarationNode::uuFloat80 || td->basictype == DeclarationNode::uuFloat128) && td->complextype == DeclarationNode::Complex ) { // gcc unsupported
     698                        genTSError( DeclarationNode::complexTypeNames[ td->complextype ], td->basictype );
     699                } // if
    688700                if ( td->length == DeclarationNode::Long ) {
    689701                        const_cast<TypeData *>(td)->basictype = DeclarationNode::LongDouble;
    690702                } // if
    691703
    692                 if ( td->basictype == DeclarationNode::Float80 || td->basictype == DeclarationNode::Float128 ) {
    693                         // if ( td->complextype != DeclarationNode::NoComplexType ) {
    694                         //      genTSError( DeclarationNode::complexTypeNames[ td->complextype ], td->basictype );
    695                         // }
    696                         if ( td->basictype == DeclarationNode::Float80 ) ret = BasicType::Float80;
    697                         else ret = BasicType::Float128;
    698                         break;
    699                 }
    700 
    701704                ret = floattype[ td->complextype ][ td->basictype - DeclarationNode::Float ];
     705                //printf( "XXXX %d %d %d %d\n", td->complextype, td->basictype, DeclarationNode::Float, ret );
    702706                break;
    703707
  • src/Parser/TypeData.h

    r9d9a451 r53bb8f1  
    3131        struct Aggregate_t {
    3232                DeclarationNode::Aggregate kind;
    33                 const std::string * name;
    34                 DeclarationNode * params;
    35                 ExpressionNode * actuals;                                               // holds actual parameters later applied to AggInst
    36                 DeclarationNode * fields;
     33                const std::string * name = nullptr;
     34                DeclarationNode * params = nullptr;
     35                ExpressionNode * actuals = nullptr;                                             // holds actual parameters later applied to AggInst
     36                DeclarationNode * fields = nullptr;
    3737                bool body;
    3838                bool anon;
    3939
    4040                bool tagged;
    41                 const std::string * parent;
     41                const std::string * parent = nullptr;
    4242        };
    4343
    4444        struct AggInst_t {
    45                 TypeData * aggregate;
    46                 ExpressionNode * params;
     45                TypeData * aggregate = nullptr;
     46                ExpressionNode * params = nullptr;
    4747                bool hoistType;
    4848        };
    4949
    5050        struct Array_t {
    51                 ExpressionNode * dimension;
     51                ExpressionNode * dimension = nullptr;
    5252                bool isVarLen;
    5353                bool isStatic;
     
    5555
    5656        struct Enumeration_t {
    57                 const std::string * name;
    58                 DeclarationNode * constants;
     57                const std::string * name = nullptr;
     58                DeclarationNode * constants = nullptr;
    5959                bool body;
    6060                bool anon;
     
    6262
    6363        struct Function_t {
    64                 mutable DeclarationNode * params;                               // mutables modified in buildKRFunction
    65                 mutable DeclarationNode * idList;                               // old-style
    66                 mutable DeclarationNode * oldDeclList;
    67                 StatementNode * body;
    68                 ExpressionNode * withExprs;                                             // expressions from function's with_clause
     64                mutable DeclarationNode * params = nullptr;                             // mutables modified in buildKRFunction
     65                mutable DeclarationNode * idList = nullptr;                             // old-style
     66                mutable DeclarationNode * oldDeclList = nullptr;
     67                StatementNode * body = nullptr;
     68                ExpressionNode * withExprs = nullptr;                                           // expressions from function's with_clause
    6969        };
    7070
    7171        struct Symbolic_t {
    72                 const std::string * name;
     72                const std::string * name = nullptr;
    7373                bool isTypedef;                                                                 // false => TYPEGENname, true => TYPEDEFname
    74                 DeclarationNode * params;
    75                 ExpressionNode * actuals;
    76                 DeclarationNode * assertions;
     74                DeclarationNode * params = nullptr;
     75                ExpressionNode * actuals = nullptr;
     76                DeclarationNode * assertions = nullptr;
    7777        };
    7878
    7979        struct Qualified_t {                                                            // qualified type S.T
    80                 TypeData * parent;
    81                 TypeData * child;
     80                TypeData * parent = nullptr;
     81                TypeData * child = nullptr;
    8282        };
    8383
     
    9393
    9494        Type::Qualifiers qualifiers;
    95         DeclarationNode * forall;
     95        DeclarationNode * forall = nullptr;
    9696
    9797        Aggregate_t aggregate;
     
    102102        Symbolic_t symbolic;
    103103        Qualified_t qualified;
    104         DeclarationNode * tuple;
    105         ExpressionNode * typeexpr;
     104        DeclarationNode * tuple = nullptr;
     105        ExpressionNode * typeexpr = nullptr;
    106106
    107107        TypeData( Kind k = Unknown );
  • src/Parser/lex.ll

    r9d9a451 r53bb8f1  
    1010 * Created On       : Sat Sep 22 08:58:10 2001
    1111 * Last Modified By : Peter A. Buhr
    12  * Last Modified On : Thu Nov  1 20:57:35 2018
    13  * Update Count     : 687
     12 * Last Modified On : Sun Mar 10 09:13:09 2019
     13 * Update Count     : 706
    1414 */
    1515
     
    3939using namespace std;
    4040
     41#include "config.h"                                                                             // configure info
    4142#include "ParseNode.h"
    4243#include "TypedefTable.h"
     
    5960#define IDENTIFIER_RETURN()     RETURN_VAL( typedefTable.isKind( yytext ) )
    6061#define ATTRIBUTE_RETURN()      RETURN_VAL( ATTR_IDENTIFIER )
     62
     63#ifdef HAVE_KEYWORDS_FLOATXX                                                            // GCC >= 7 => keyword, otherwise typedef
     64#define FLOATXX(v) KEYWORD_RETURN(v);
     65#else
     66#define FLOATXX(v) IDENTIFIER_RETURN();
     67#endif // HAVE_KEYWORDS_FLOATXX
    6168
    6269void rm_underscore() {
     
    9299hex_quad {hex}("_"?{hex}){3}
    93100size_opt (8|16|32|64|128)?
    94 length ("ll"|"LL"|[lL]{size_opt})|("hh"|"HH"|[hH])
    95 integer_suffix_opt ("_"?(([uU]({length}?[iI]?)|([iI]{length}))|([iI]({length}?[uU]?)|([uU]{length}))|({length}([iI]?[uU]?)|([uU][iI]))|[zZ]))?
     101                                // CFA: explicit l8/l16/l32/l64/l128, char 'hh', short 'h', int 'n'
     102length ("ll"|"LL"|[lL]{size_opt})|("hh"|"HH"|[hHnN])
     103                                // CFA: size_t 'z', pointer 'p', which define a sign and length
     104integer_suffix_opt ("_"?(([uU]({length}?[iI]?)|([iI]{length}))|([iI]({length}?[uU]?)|([uU]{length}))|({length}([iI]?[uU]?)|([uU][iI]))|[zZ]|[pP]))?
    96105
    97106octal_digits ({octal})|({octal}({octal}|"_")*{octal})
     
    112121                                // GCC: D (double) and iI (imaginary) suffixes, and DL (long double)
    113122exponent "_"?[eE]"_"?[+-]?{decimal_digits}
    114 floating_size 32|64|80|128
    115 floating_length ([fFdDlL]|[lL]{floating_size})
     123floating_size 16|32|32x|64|64x|80|128|128x
     124floating_length ([fFdDlLwWqQ]|[fF]{floating_size})
    116125floating_suffix ({floating_length}?[iI]?)|([iI]{floating_length})
    117126floating_suffix_opt ("_"?({floating_suffix}|"DL"))?
     
    240249finally                 { KEYWORD_RETURN(FINALLY); }                    // CFA
    241250float                   { KEYWORD_RETURN(FLOAT); }
    242 _Float32                { KEYWORD_RETURN(FLOAT); }                              // GCC
    243 _Float32x               { KEYWORD_RETURN(FLOAT); }                              // GCC
    244 _Float64                { KEYWORD_RETURN(DOUBLE); }                             // GCC
    245 _Float64x               { KEYWORD_RETURN(DOUBLE); }                             // GCC
    246 __float80               { KEYWORD_RETURN(FLOAT80); }                    // GCC
    247 float80                 { KEYWORD_RETURN(FLOAT80); }                    // GCC
    248 _Float128               { KEYWORD_RETURN(FLOAT128); }                   // GCC
    249 _Float128x              { KEYWORD_RETURN(FLOAT128); }                   // GCC
    250 __float128              { KEYWORD_RETURN(FLOAT128); }                   // GCC
    251 float128                { KEYWORD_RETURN(FLOAT128); }                   // GCC
     251__float80               { KEYWORD_RETURN(uuFLOAT80); }                  // GCC
     252float80                 { KEYWORD_RETURN(uuFLOAT80); }                  // GCC
     253__float128              { KEYWORD_RETURN(uuFLOAT128); }                 // GCC
     254float128                { KEYWORD_RETURN(uuFLOAT128); }                 // GCC
     255_Float16                { FLOATXX(uFLOAT16); }                                  // GCC
     256_Float32                { FLOATXX(uFLOAT32); }                                  // GCC
     257_Float32x               { FLOATXX(uFLOAT32X); }                                 // GCC
     258_Float64                { FLOATXX(uFLOAT64); }                                  // GCC
     259_Float64x               { FLOATXX(uFLOAT64X); }                                 // GCC
     260_Float128               { FLOATXX(uFLOAT128); }                                 // GCC
     261_Float128x              { FLOATXX(uFLOAT128); }                                 // GCC
    252262for                             { KEYWORD_RETURN(FOR); }
    253263forall                  { KEYWORD_RETURN(FORALL); }                             // CFA
  • src/Parser/module.mk

    r9d9a451 r53bb8f1  
    3131       Parser/parserutility.cc
    3232
    33 MOSTLYCLEANFILES += Parser/parser.hh Parser/parser.output
     33SRCDEMANGLE += \
     34        Parser/LinkageSpec.cc
     35
     36
     37MOSTLYCLEANFILES += Parser/lex.cc Parser/parser.cc Parser/parser.hh Parser/parser.output
  • src/Parser/parser.yy

    r9d9a451 r53bb8f1  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Nov  8 18:08:23 2018
    13 // Update Count     : 4052
     12// Last Modified On : Thu Feb 21 08:45:07 2019
     13// Update Count     : 4232
    1414//
    1515
     
    9999        // distribute declaration_specifier across all declared variables, e.g., static, const, __attribute__.
    100100        DeclarationNode * cur = declList, * cl = (new DeclarationNode)->addType( specifier );
    101         //cur->addType( specifier );
    102         for ( cur = dynamic_cast< DeclarationNode * >( cur->get_next() ); cur != nullptr; cur = dynamic_cast< DeclarationNode * >( cur->get_next() ) ) {
     101        for ( cur = dynamic_cast<DeclarationNode *>( cur->get_next() ); cur != nullptr; cur = dynamic_cast<DeclarationNode *>( cur->get_next() ) ) {
    103102                cl->cloneBaseType( cur );
    104103        } // for
    105104        declList->addType( cl );
    106 //      delete cl;
    107105        return declList;
    108106} // distAttr
     
    193191        return new ForCtrl(
    194192                distAttr( DeclarationNode::newTypeof( type, true ), DeclarationNode::newName( index )->addInitializer( new InitializerNode( start ) ) ),
    195                 new ExpressionNode( build_binary_val( compop, new ExpressionNode( build_varref( new string( *index ) ) ), comp ) ),
    196                 new ExpressionNode( build_binary_val( compop == OperKinds::LThan || compop == OperKinds::LEThan ? // choose += or -= for upto/downto
    197                                                                                           OperKinds::PlusAssn : OperKinds::MinusAssn, new ExpressionNode( build_varref( new string( *index ) ) ), inc ) ) );
     193                // NULL comp/inc => leave blank
     194                comp ? new ExpressionNode( build_binary_val( compop, new ExpressionNode( build_varref( new string( *index ) ) ), comp ) ) : 0,
     195                inc ? new ExpressionNode( build_binary_val( compop == OperKinds::LThan || compop == OperKinds::LEThan ? // choose += or -= for upto/downto
     196                                                        OperKinds::PlusAssn : OperKinds::MinusAssn, new ExpressionNode( build_varref( new string( *index ) ) ), inc ) ) : 0 );
    198197} // forCtrl
    199198
     
    201200        if ( NameExpr * identifier = dynamic_cast<NameExpr *>(index->get_expr()) ) {
    202201                return forCtrl( type, new string( identifier->name ), start, compop, comp, inc );
     202        } else if ( CommaExpr * commaExpr = dynamic_cast<CommaExpr *>(index->get_expr()) ) {
     203                if ( NameExpr * identifier = dynamic_cast<NameExpr *>(commaExpr->arg1 ) ) {
     204                        return forCtrl( type, new string( identifier->name ), start, compop, comp, inc );
     205                } else {
     206                        SemanticError( yylloc, "Expression disallowed. Only loop-index name allowed" ); return nullptr;
     207                } // if
    203208        } else {
    204209                SemanticError( yylloc, "Expression disallowed. Only loop-index name allowed" ); return nullptr;
     
    263268%token VOID CHAR SHORT INT LONG FLOAT DOUBLE SIGNED UNSIGNED
    264269%token BOOL COMPLEX IMAGINARY                                                   // C99
    265 %token INT128 FLOAT80 FLOAT128                                                  // GCC
     270%token INT128 uuFLOAT80 uuFLOAT128                                              // GCC
     271%token uFLOAT16 uFLOAT32 uFLOAT32X uFLOAT64 uFLOAT64X uFLOAT128 // GCC
    266272%token ZERO_T ONE_T                                                                             // CFA
    267273%token VALIST                                                                                   // GCC
     
    324330%type<en> argument_expression_list              argument_expression                     default_initialize_opt
    325331%type<ifctl> if_control_expression
    326 %type<fctl> for_control_expression
     332%type<fctl> for_control_expression              for_control_expression_list
    327333%type<compop> inclexcl
    328334%type<en> subrange
     
    984990                // labels cannot be identifiers 0 or 1 or ATTR_IDENTIFIER
    985991        identifier_or_type_name ':' attribute_list_opt statement
    986                 {
    987                         $$ = $4->add_label( $1, $3 );
    988                 }
     992                { $$ = $4->add_label( $1, $3 ); }
    989993        ;
    990994
     
    10021006        statement_decl
    10031007        | statement_decl_list statement_decl
    1004                 { if ( $1 != 0 ) { $1->set_last( $2 ); $$ = $1; } }
     1008                { assert( $1 ); $1->set_last( $2 ); $$ = $1; }
    10051009        ;
    10061010
     
    10091013                { $$ = new StatementNode( $1 ); }
    10101014        | EXTENSION declaration                                                         // GCC
    1011                 {
    1012                         distExt( $2 );
    1013                         $$ = new StatementNode( $2 );
    1014                 }
     1015                { distExt( $2 ); $$ = new StatementNode( $2 ); }
    10151016        | function_definition
    10161017                { $$ = new StatementNode( $1 ); }
    10171018        | EXTENSION function_definition                                         // GCC
    1018                 {
    1019                         distExt( $2 );
    1020                         $$ = new StatementNode( $2 );
    1021                 }
     1019                { distExt( $2 ); $$ = new StatementNode( $2 ); }
    10221020        | statement
    10231021        ;
     
    10261024        statement
    10271025        | statement_list_nodecl statement
    1028                 { if ( $1 != 0 ) { $1->set_last( $2 ); $$ = $1; } }
     1026                { assert( $1 ); $1->set_last( $2 ); $$ = $1; }
    10291027        ;
    10301028
     
    11381136        | DO statement WHILE '(' ')' ';'                                        // CFA => do while( 1 )
    11391137                { $$ = new StatementNode( build_do_while( new ExpressionNode( build_constantInteger( *new string( "1" ) ) ), $2 ) ); }
    1140         | FOR '(' push for_control_expression ')' statement pop
     1138        | FOR '(' push for_control_expression_list ')' statement pop
    11411139                { $$ = new StatementNode( build_for( $4, $6 ) ); }
    11421140        | FOR '(' ')' statement                                                         // CFA => for ( ;; )
     
    11441142        ;
    11451143
     1144for_control_expression_list:
     1145        for_control_expression
     1146        | for_control_expression_list ':' for_control_expression
     1147                { $$ = $3; }
     1148        ;
     1149
    11461150for_control_expression:
    1147         comma_expression                                                                        // CFA
     1151        ';' comma_expression_opt ';' comma_expression_opt
     1152                { $$ = new ForCtrl( (ExpressionNode * )nullptr, $2, $4 ); }
     1153        | comma_expression ';' comma_expression_opt ';' comma_expression_opt
     1154                { $$ = new ForCtrl( $1, $3, $5 ); }
     1155        | declaration comma_expression_opt ';' comma_expression_opt // C99, declaration has ';'
     1156                { $$ = new ForCtrl( $1, $2, $4 ); }
     1157        | comma_expression                                                                      // CFA
    11481158                { $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), new ExpressionNode( build_constantInteger( *new string( "0" ) ) ),
    11491159                                                OperKinds::LThan, $1->clone(), new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); }
    1150         | constant_expression inclexcl constant_expression      // CFA
     1160        | comma_expression inclexcl comma_expression            // CFA
    11511161                { $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), $1->clone(), $2, $3, new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); }
    1152         | constant_expression inclexcl constant_expression '~' constant_expression // CFA
     1162        | comma_expression inclexcl comma_expression '~' comma_expression // CFA
    11531163                { $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), $1->clone(), $2, $3, $5 ); }
    11541164        | comma_expression ';' comma_expression                         // CFA
    11551165                { $$ = forCtrl( $3, $1, new ExpressionNode( build_constantInteger( *new string( "0" ) ) ),
    11561166                                                OperKinds::LThan, $3->clone(), new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); }
    1157         | comma_expression ';' constant_expression inclexcl constant_expression // CFA
     1167        | comma_expression ';' comma_expression inclexcl comma_expression // CFA
    11581168                { $$ = forCtrl( $3, $1, $3->clone(), $4, $5, new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); }
    1159         | comma_expression ';' constant_expression inclexcl constant_expression '~' constant_expression // CFA
     1169        | comma_expression ';' comma_expression inclexcl comma_expression '~' comma_expression // CFA
    11601170                { $$ = forCtrl( $3, $1, $3->clone(), $4, $5, $7 ); }
    1161         | comma_expression ';' comma_expression_opt ';' comma_expression_opt
    1162                 { $$ = new ForCtrl( $1, $3, $5 ); }
    1163         | ';' comma_expression_opt ';' comma_expression_opt
    1164                 { $$ = new ForCtrl( (ExpressionNode * )nullptr, $2, $4 ); }
    1165         | declaration comma_expression_opt ';' comma_expression_opt // C99, declaration has ';'
    1166                 { $$ = new ForCtrl( $1, $2, $4 ); }
     1171        | comma_expression ';' comma_expression '~' '@' '~' comma_expression // CFA
     1172                { $$ = forCtrl( $3, $1, $3->clone(), OperKinds::LThan, nullptr, $7 ); }
     1173        | comma_expression ';' comma_expression ErangeDown '@' '~' comma_expression // CFA
     1174                { $$ = forCtrl( $3, $1, $3->clone(), OperKinds::GThan, nullptr, $7 ); }
     1175        | comma_expression ';' comma_expression '~' '@' '~' '@' // CFA
     1176                { $$ = forCtrl( $3, $1, $3->clone(), OperKinds::LThan, nullptr, nullptr ); }
    11671177        ;
    11681178
     
    17711781        | FLOAT
    17721782                { $$ = DeclarationNode::newBasicType( DeclarationNode::Float ); }
    1773         | FLOAT80
    1774                 { $$ = DeclarationNode::newBasicType( DeclarationNode::Float80 ); }
    1775         | FLOAT128
    1776                 { $$ = DeclarationNode::newBasicType( DeclarationNode::Float128 ); }
    17771783        | DOUBLE
    17781784                { $$ = DeclarationNode::newBasicType( DeclarationNode::Double ); }
     1785        | uuFLOAT80
     1786                { $$ = DeclarationNode::newBasicType( DeclarationNode::uuFloat80 ); }
     1787        | uuFLOAT128
     1788                { $$ = DeclarationNode::newBasicType( DeclarationNode::uuFloat128 ); }
     1789        | uFLOAT16
     1790                { $$ = DeclarationNode::newBasicType( DeclarationNode::uFloat16 ); }
     1791        | uFLOAT32
     1792                { $$ = DeclarationNode::newBasicType( DeclarationNode::uFloat32 ); }
     1793        | uFLOAT32X
     1794                { $$ = DeclarationNode::newBasicType( DeclarationNode::uFloat32x ); }
     1795        | uFLOAT64
     1796                { $$ = DeclarationNode::newBasicType( DeclarationNode::uFloat64 ); }
     1797        | uFLOAT64X
     1798                { $$ = DeclarationNode::newBasicType( DeclarationNode::uFloat64x ); }
     1799        | uFLOAT128
     1800                { $$ = DeclarationNode::newBasicType( DeclarationNode::uFloat128 ); }
    17791801        | COMPLEX                                                                                       // C99
    17801802                { $$ = DeclarationNode::newComplexType( DeclarationNode::Complex ); }
  • src/ResolvExpr/AlternativeFinder.cc

    r9d9a451 r53bb8f1  
    474474                }
    475475
    476                 // mark specialization cost of return types
    477                 for ( DeclarationWithType* returnVal : function->returnVals ) {
    478                         convCost.decSpec( specCost( returnVal->get_type() ) );
    479                 }
     476                // specialization cost of return types can't be accounted for directly, it disables
     477                // otherwise-identical calls, like this example based on auto-newline in the I/O lib:
     478                //
     479                //   forall(otype OS) {
     480                //     void ?|?(OS&, int);  // with newline
     481                //     OS&  ?|?(OS&, int);  // no newline, always chosen due to more specialization
     482                //   }
    480483
    481484                // mark type variable and specialization cost of forall clause
     
    483486                for ( TypeDecl* td : function->forall ) {
    484487                        convCost.decSpec( td->assertions.size() );
    485                 }
    486 
    487                 // xxx -- replace with new costs in resolver
    488                 for ( InferredParams::const_iterator assert = appExpr->inferParams.begin(); assert != appExpr->inferParams.end(); ++assert ) {
    489                         convCost += computeConversionCost( assert->second.actualType, assert->second.formalType, indexer, alt.env );
    490488                }
    491489
     
    12291227                                Alternative newAlt{
    12301228                                        restructureCast( alt.expr->clone(), toType, castExpr->isGenerated ),
    1231                                         alt.env, openVars, needAssertions, alt.cost + thisCost, thisCost };
     1229                                        alt.env, openVars, needAssertions, alt.cost, alt.cost + thisCost };
    12321230                                inferParameters( newAlt, back_inserter( candidates ) );
    12331231                        } // if
  • src/ResolvExpr/CommonType.cc

    r9d9a451 r53bb8f1  
    1010// Created On       : Sun May 17 06:59:27 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Sep 25 15:18:17 2017
    13 // Update Count     : 9
     12// Last Modified On : Thu Feb 14 17:10:10 2019
     13// Update Count     : 24
    1414//
    1515
     
    176176        }
    177177
    178         static const BasicType::Kind combinedType[][ BasicType::NUMBER_OF_BASIC_TYPES ] =
    179         {
    180 /*              Bool            Char    SignedChar      UnsignedChar    ShortSignedInt  ShortUnsignedInt        SignedInt       UnsignedInt     LongSignedInt   LongUnsignedInt LongLongSignedInt       LongLongUnsignedInt     Float   Double  LongDouble      FloatComplex    DoubleComplex   LongDoubleComplex       FloatImaginary  DoubleImaginary LongDoubleImaginary   SignedInt128   UnsignedInt128   Float80   Float128 */
    181                 /* Bool */      { BasicType::Bool,              BasicType::Char,        BasicType::SignedChar,  BasicType::UnsignedChar,        BasicType::ShortSignedInt,      BasicType::ShortUnsignedInt,    BasicType::SignedInt,   BasicType::UnsignedInt, BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, BasicType::Float80, BasicType::Float128 },
    182                 /* Char */      { BasicType::Char,              BasicType::Char,        BasicType::UnsignedChar,        BasicType::UnsignedChar,        BasicType::ShortSignedInt,      BasicType::ShortUnsignedInt,    BasicType::SignedInt,   BasicType::UnsignedInt, BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, BasicType::Float80, BasicType::Float128 },
    183                 /* SignedChar */        { BasicType::SignedChar,        BasicType::UnsignedChar,        BasicType::SignedChar,  BasicType::UnsignedChar,        BasicType::ShortSignedInt,      BasicType::ShortUnsignedInt,    BasicType::SignedInt,   BasicType::UnsignedInt, BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, BasicType::Float80, BasicType::Float128 },
    184                 /* UnsignedChar */      { BasicType::UnsignedChar,      BasicType::UnsignedChar,        BasicType::UnsignedChar,        BasicType::UnsignedChar,        BasicType::ShortSignedInt,      BasicType::ShortUnsignedInt,    BasicType::SignedInt,   BasicType::UnsignedInt, BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, BasicType::Float80, BasicType::Float128 },
    185                 /* ShortSignedInt */    { BasicType::ShortSignedInt,    BasicType::ShortSignedInt,      BasicType::ShortSignedInt,      BasicType::ShortSignedInt,      BasicType::ShortSignedInt,      BasicType::ShortUnsignedInt,    BasicType::SignedInt,   BasicType::UnsignedInt, BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, BasicType::Float80, BasicType::Float128 },
    186                 /* ShortUnsignedInt */  { BasicType::ShortUnsignedInt,  BasicType::ShortUnsignedInt,    BasicType::ShortUnsignedInt,    BasicType::ShortUnsignedInt,    BasicType::ShortUnsignedInt,    BasicType::ShortUnsignedInt,    BasicType::SignedInt,   BasicType::UnsignedInt, BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, BasicType::Float80, BasicType::Float128 },
    187                 /* SignedInt */         { BasicType::SignedInt,         BasicType::SignedInt,   BasicType::SignedInt,   BasicType::SignedInt,   BasicType::SignedInt,   BasicType::SignedInt,   BasicType::SignedInt,   BasicType::UnsignedInt, BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, BasicType::Float80, BasicType::Float128 },
    188                 /* UnsignedInt */       { BasicType::UnsignedInt,               BasicType::UnsignedInt, BasicType::UnsignedInt, BasicType::UnsignedInt, BasicType::UnsignedInt, BasicType::UnsignedInt, BasicType::UnsignedInt, BasicType::UnsignedInt, BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, BasicType::Float80, BasicType::Float128 },
    189                 /* LongSignedInt */     { BasicType::LongSignedInt,             BasicType::LongSignedInt,       BasicType::LongSignedInt,       BasicType::LongSignedInt,       BasicType::LongSignedInt,       BasicType::LongSignedInt,       BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongSignedInt,       BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, BasicType::Float80, BasicType::Float128 },
    190                 /* LongUnsignedInt */   { BasicType::LongUnsignedInt,   BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongUnsignedInt,     BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, BasicType::Float80, BasicType::Float128 },
    191                 /* LongLongSignedInt */         { BasicType::LongLongSignedInt, BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongSignedInt,   BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, BasicType::Float80, BasicType::Float128 },
    192                 /* LongLongUnsignedInt */       { BasicType::LongLongUnsignedInt,       BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::LongLongUnsignedInt, BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, BasicType::Float80, BasicType::Float128 },
    193                 /* Float */     { BasicType::Float,     BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::Float,       BasicType::Float, BasicType::Float80, BasicType::Float128 },
    194                 /* Double */    { BasicType::Double,    BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::Double,      BasicType::LongDouble,  BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::Double,      BasicType::Double, BasicType::Float80, BasicType::Float128 },
    195                 /* LongDouble */        { BasicType::LongDouble,                BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDouble,  BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDouble,  BasicType::LongDouble, BasicType::BasicType::LongDouble, BasicType::Float128 },
    196                 /* FloatComplex */      { BasicType::FloatComplex,      BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::FloatComplex, BasicType::LongDoubleComplex, BasicType::LongDoubleComplex, },
    197                 /* DoubleComplex */     { BasicType::DoubleComplex,     BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::DoubleComplex,       BasicType::DoubleComplex, BasicType::LongDoubleComplex, BasicType::LongDoubleComplex },
    198                 /* LongDoubleComplex */         { BasicType::LongDoubleComplex, BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex, BasicType::LongDoubleComplex, BasicType::LongDoubleComplex, },
    199                 /* FloatImaginary */    { BasicType::FloatComplex,      BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatImaginary,      BasicType::DoubleImaginary,     BasicType::LongDoubleImaginary, BasicType::FloatImaginary,      BasicType::FloatImaginary, BasicType::LongDoubleImaginary, BasicType::LongDoubleImaginary, },
    200                 /* DoubleImaginary */   { BasicType::DoubleComplex,     BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::DoubleComplex,       BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::DoubleImaginary,     BasicType::DoubleImaginary,     BasicType::LongDoubleImaginary, BasicType::DoubleImaginary,     BasicType::DoubleImaginary, BasicType::LongDoubleImaginary, BasicType::LongDoubleImaginary, },
    201                 /* LongDoubleImaginary */       { BasicType::LongDoubleComplex, BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleImaginary, BasicType::LongDoubleImaginary, BasicType::LongDoubleImaginary, BasicType::LongDoubleImaginary, BasicType::LongDoubleImaginary, },
    202                 /* SignedInt128 */      { BasicType::SignedInt128,      BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::SignedInt128,        BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::SignedInt128,        BasicType::UnsignedInt128, BasicType::Float80, BasicType::Float128, },
    203                 /* UnsignedInt128 */    { BasicType::UnsignedInt128,    BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::UnsignedInt128,      BasicType::Float,       BasicType::Double,      BasicType::LongDouble,  BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::FloatComplex,        BasicType::DoubleComplex,       BasicType::LongDoubleComplex,   BasicType::UnsignedInt128,      BasicType::UnsignedInt128, BasicType::Float80, BasicType::Float128, },
    204                 /* Float80 */   { BasicType::Float80,   BasicType::Float80,     BasicType::Float80,     BasicType::Float80,     BasicType::Float80,     BasicType::Float80,     BasicType::Float80,     BasicType::Float80,     BasicType::Float80,     BasicType::Float80,     BasicType::Float80,     BasicType::Float80,     BasicType::Float80,     BasicType::Float80,     BasicType::LongDouble,  BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::Float80,     BasicType::Float80, BasicType::Float80, BasicType::Float128 },
    205                 /* Float128 */  { BasicType::Float128,  BasicType::Float128,    BasicType::Float128,    BasicType::Float128,    BasicType::Float128,    BasicType::Float128,    BasicType::Float128,    BasicType::Float128,    BasicType::Float128,    BasicType::Float128,    BasicType::Float128,    BasicType::Float128,    BasicType::Float128,    BasicType::Float128,    BasicType::Float128,    BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::LongDoubleComplex,   BasicType::Float128,    BasicType::Float128, BasicType::Float128, BasicType::Float128 },
    206         };
     178        // GENERATED START, DO NOT EDIT
     179        // GENERATED BY BasicTypes-gen.cc
     180        #define BT BasicType::
     181        static const BasicType::Kind commonTypes[BasicType::NUMBER_OF_BASIC_TYPES][BasicType::NUMBER_OF_BASIC_TYPES] = { // nearest common ancestor
     182                /*                                      B                       C                      SC                      UC                      SI                     SUI
     183                                                        I                      UI                      LI                     LUI                     LLI                    LLUI
     184                                                       IB                     UIB                     _FH                     _FH                      _F                     _FC
     185                                                        F                      FC                     _FX                    _FXC                      FD                    _FDC
     186                                                        D                      DC                    F80X                   _FDXC                     F80                     _FB
     187                                                    _FLDC                      FB                      LD                     LDC                    _FBX                  _FLDXC
     188                                 */
     189                                  {
     190                /*     B*/                BT Bool,                BT Char,          BT SignedChar,        BT UnsignedChar,      BT ShortSignedInt,    BT ShortUnsignedInt,
     191                                             BT SignedInt,         BT UnsignedInt,       BT LongSignedInt,     BT LongUnsignedInt,   BT LongLongSignedInt, BT LongLongUnsignedInt,
     192                                          BT SignedInt128,      BT UnsignedInt128,            BT uFloat16,     BT uFloat16Complex,            BT uFloat32,     BT uFloat32Complex,
     193                                                 BT Float,        BT FloatComplex,           BT uFloat32x,    BT uFloat32xComplex,            BT uFloat64,     BT uFloat64Complex,
     194                                                BT Double,       BT DoubleComplex,           BT uFloat64x,    BT uFloat64xComplex,           BT uuFloat80,           BT uFloat128,
     195                                      BT uFloat128Complex,          BT uuFloat128,          BT LongDouble,   BT LongDoubleComplex,          BT uFloat128x,   BT uFloat128xComplex,
     196                                  },
     197                                  {
     198                /*     C*/                BT Char,                BT Char,          BT SignedChar,        BT UnsignedChar,      BT ShortSignedInt,    BT ShortUnsignedInt,
     199                                             BT SignedInt,         BT UnsignedInt,       BT LongSignedInt,     BT LongUnsignedInt,   BT LongLongSignedInt, BT LongLongUnsignedInt,
     200                                          BT SignedInt128,      BT UnsignedInt128,            BT uFloat16,     BT uFloat16Complex,            BT uFloat32,     BT uFloat32Complex,
     201                                                 BT Float,        BT FloatComplex,           BT uFloat32x,    BT uFloat32xComplex,            BT uFloat64,     BT uFloat64Complex,
     202                                                BT Double,       BT DoubleComplex,           BT uFloat64x,    BT uFloat64xComplex,           BT uuFloat80,           BT uFloat128,
     203                                      BT uFloat128Complex,          BT uuFloat128,          BT LongDouble,   BT LongDoubleComplex,          BT uFloat128x,   BT uFloat128xComplex,
     204                                  },
     205                                  {
     206                /*    SC*/          BT SignedChar,          BT SignedChar,          BT SignedChar,        BT UnsignedChar,      BT ShortSignedInt,    BT ShortUnsignedInt,
     207                                             BT SignedInt,         BT UnsignedInt,       BT LongSignedInt,     BT LongUnsignedInt,   BT LongLongSignedInt, BT LongLongUnsignedInt,
     208                                          BT SignedInt128,      BT UnsignedInt128,            BT uFloat16,     BT uFloat16Complex,            BT uFloat32,     BT uFloat32Complex,
     209                                                 BT Float,        BT FloatComplex,           BT uFloat32x,    BT uFloat32xComplex,            BT uFloat64,     BT uFloat64Complex,
     210                                                BT Double,       BT DoubleComplex,           BT uFloat64x,    BT uFloat64xComplex,           BT uuFloat80,           BT uFloat128,
     211                                      BT uFloat128Complex,          BT uuFloat128,          BT LongDouble,   BT LongDoubleComplex,          BT uFloat128x,   BT uFloat128xComplex,
     212                                  },
     213                                  {
     214                /*    UC*/        BT UnsignedChar,        BT UnsignedChar,        BT UnsignedChar,        BT UnsignedChar,      BT ShortSignedInt,    BT ShortUnsignedInt,
     215                                             BT SignedInt,         BT UnsignedInt,       BT LongSignedInt,     BT LongUnsignedInt,   BT LongLongSignedInt, BT LongLongUnsignedInt,
     216                                          BT SignedInt128,      BT UnsignedInt128,            BT uFloat16,     BT uFloat16Complex,            BT uFloat32,     BT uFloat32Complex,
     217                                                 BT Float,        BT FloatComplex,           BT uFloat32x,    BT uFloat32xComplex,            BT uFloat64,     BT uFloat64Complex,
     218                                                BT Double,       BT DoubleComplex,           BT uFloat64x,    BT uFloat64xComplex,           BT uuFloat80,           BT uFloat128,
     219                                      BT uFloat128Complex,          BT uuFloat128,          BT LongDouble,   BT LongDoubleComplex,          BT uFloat128x,   BT uFloat128xComplex,
     220                                  },
     221                                  {
     222                /*    SI*/      BT ShortSignedInt,      BT ShortSignedInt,      BT ShortSignedInt,      BT ShortSignedInt,      BT ShortSignedInt,    BT ShortUnsignedInt,
     223                                             BT SignedInt,         BT UnsignedInt,       BT LongSignedInt,     BT LongUnsignedInt,   BT LongLongSignedInt, BT LongLongUnsignedInt,
     224                                          BT SignedInt128,      BT UnsignedInt128,            BT uFloat16,     BT uFloat16Complex,            BT uFloat32,     BT uFloat32Complex,
     225                                                 BT Float,        BT FloatComplex,           BT uFloat32x,    BT uFloat32xComplex,            BT uFloat64,     BT uFloat64Complex,
     226                                                BT Double,       BT DoubleComplex,           BT uFloat64x,    BT uFloat64xComplex,           BT uuFloat80,           BT uFloat128,
     227                                      BT uFloat128Complex,          BT uuFloat128,          BT LongDouble,   BT LongDoubleComplex,          BT uFloat128x,   BT uFloat128xComplex,
     228                                  },
     229                                  {
     230                /*   SUI*/    BT ShortUnsignedInt,    BT ShortUnsignedInt,    BT ShortUnsignedInt,    BT ShortUnsignedInt,    BT ShortUnsignedInt,    BT ShortUnsignedInt,
     231                                             BT SignedInt,         BT UnsignedInt,       BT LongSignedInt,     BT LongUnsignedInt,   BT LongLongSignedInt, BT LongLongUnsignedInt,
     232                                          BT SignedInt128,      BT UnsignedInt128,            BT uFloat16,     BT uFloat16Complex,            BT uFloat32,     BT uFloat32Complex,
     233                                                 BT Float,        BT FloatComplex,           BT uFloat32x,    BT uFloat32xComplex,            BT uFloat64,     BT uFloat64Complex,
     234                                                BT Double,       BT DoubleComplex,           BT uFloat64x,    BT uFloat64xComplex,           BT uuFloat80,           BT uFloat128,
     235                                      BT uFloat128Complex,          BT uuFloat128,          BT LongDouble,   BT LongDoubleComplex,          BT uFloat128x,   BT uFloat128xComplex,
     236                                  },
     237                                  {
     238                /*     I*/           BT SignedInt,           BT SignedInt,           BT SignedInt,           BT SignedInt,           BT SignedInt,           BT SignedInt,
     239                                             BT SignedInt,         BT UnsignedInt,       BT LongSignedInt,     BT LongUnsignedInt,   BT LongLongSignedInt, BT LongLongUnsignedInt,
     240                                          BT SignedInt128,      BT UnsignedInt128,            BT uFloat16,     BT uFloat16Complex,            BT uFloat32,     BT uFloat32Complex,
     241                                                 BT Float,        BT FloatComplex,           BT uFloat32x,    BT uFloat32xComplex,            BT uFloat64,     BT uFloat64Complex,
     242                                                BT Double,       BT DoubleComplex,           BT uFloat64x,    BT uFloat64xComplex,           BT uuFloat80,           BT uFloat128,
     243                                      BT uFloat128Complex,          BT uuFloat128,          BT LongDouble,   BT LongDoubleComplex,          BT uFloat128x,   BT uFloat128xComplex,
     244                                  },
     245                                  {
     246                /*    UI*/         BT UnsignedInt,         BT UnsignedInt,         BT UnsignedInt,         BT UnsignedInt,         BT UnsignedInt,         BT UnsignedInt,
     247                                           BT UnsignedInt,         BT UnsignedInt,       BT LongSignedInt,     BT LongUnsignedInt,   BT LongLongSignedInt, BT LongLongUnsignedInt,
     248                                          BT SignedInt128,      BT UnsignedInt128,            BT uFloat16,     BT uFloat16Complex,            BT uFloat32,     BT uFloat32Complex,
     249                                                 BT Float,        BT FloatComplex,           BT uFloat32x,    BT uFloat32xComplex,            BT uFloat64,     BT uFloat64Complex,
     250                                                BT Double,       BT DoubleComplex,           BT uFloat64x,    BT uFloat64xComplex,           BT uuFloat80,           BT uFloat128,
     251                                      BT uFloat128Complex,          BT uuFloat128,          BT LongDouble,   BT LongDoubleComplex,          BT uFloat128x,   BT uFloat128xComplex,
     252                                  },
     253                                  {
     254                /*    LI*/       BT LongSignedInt,       BT LongSignedInt,       BT LongSignedInt,       BT LongSignedInt,       BT LongSignedInt,       BT LongSignedInt,
     255                                         BT LongSignedInt,       BT LongSignedInt,       BT LongSignedInt,     BT LongUnsignedInt,   BT LongLongSignedInt, BT LongLongUnsignedInt,
     256                                          BT SignedInt128,      BT UnsignedInt128,            BT uFloat16,     BT uFloat16Complex,            BT uFloat32,     BT uFloat32Complex,
     257                                                 BT Float,        BT FloatComplex,           BT uFloat32x,    BT uFloat32xComplex,            BT uFloat64,     BT uFloat64Complex,
     258                                                BT Double,       BT DoubleComplex,           BT uFloat64x,    BT uFloat64xComplex,           BT uuFloat80,           BT uFloat128,
     259                                      BT uFloat128Complex,          BT uuFloat128,          BT LongDouble,   BT LongDoubleComplex,          BT uFloat128x,   BT uFloat128xComplex,
     260                                  },
     261                                  {
     262                /*   LUI*/     BT LongUnsignedInt,     BT LongUnsignedInt,     BT LongUnsignedInt,     BT LongUnsignedInt,     BT LongUnsignedInt,     BT LongUnsignedInt,
     263                                       BT LongUnsignedInt,     BT LongUnsignedInt,     BT LongUnsignedInt,     BT LongUnsignedInt,   BT LongLongSignedInt, BT LongLongUnsignedInt,
     264                                          BT SignedInt128,      BT UnsignedInt128,            BT uFloat16,     BT uFloat16Complex,            BT uFloat32,     BT uFloat32Complex,
     265                                                 BT Float,        BT FloatComplex,           BT uFloat32x,    BT uFloat32xComplex,            BT uFloat64,     BT uFloat64Complex,
     266                                                BT Double,       BT DoubleComplex,           BT uFloat64x,    BT uFloat64xComplex,           BT uuFloat80,           BT uFloat128,
     267                                      BT uFloat128Complex,          BT uuFloat128,          BT LongDouble,   BT LongDoubleComplex,          BT uFloat128x,   BT uFloat128xComplex,
     268                                  },
     269                                  {
     270                /*   LLI*/   BT LongLongSignedInt,   BT LongLongSignedInt,   BT LongLongSignedInt,   BT LongLongSignedInt,   BT LongLongSignedInt,   BT LongLongSignedInt,
     271                                     BT LongLongSignedInt,   BT LongLongSignedInt,   BT LongLongSignedInt,   BT LongLongSignedInt,   BT LongLongSignedInt, BT LongLongUnsignedInt,
     272                                          BT SignedInt128,      BT UnsignedInt128,            BT uFloat16,     BT uFloat16Complex,            BT uFloat32,     BT uFloat32Complex,
     273                                                 BT Float,        BT FloatComplex,           BT uFloat32x,    BT uFloat32xComplex,            BT uFloat64,     BT uFloat64Complex,
     274                                                BT Double,       BT DoubleComplex,           BT uFloat64x,    BT uFloat64xComplex,           BT uuFloat80,           BT uFloat128,
     275                                      BT uFloat128Complex,          BT uuFloat128,          BT LongDouble,   BT LongDoubleComplex,          BT uFloat128x,   BT uFloat128xComplex,
     276                                  },
     277                                  {
     278                /*  LLUI*/ BT LongLongUnsignedInt, BT LongLongUnsignedInt, BT LongLongUnsignedInt, BT LongLongUnsignedInt, BT LongLongUnsignedInt, BT LongLongUnsignedInt,
     279                                   BT LongLongUnsignedInt, BT LongLongUnsignedInt, BT LongLongUnsignedInt, BT LongLongUnsignedInt, BT LongLongUnsignedInt, BT LongLongUnsignedInt,
     280                                          BT SignedInt128,      BT UnsignedInt128,            BT uFloat16,     BT uFloat16Complex,            BT uFloat32,     BT uFloat32Complex,
     281                                                 BT Float,        BT FloatComplex,           BT uFloat32x,    BT uFloat32xComplex,            BT uFloat64,     BT uFloat64Complex,
     282                                                BT Double,       BT DoubleComplex,           BT uFloat64x,    BT uFloat64xComplex,           BT uuFloat80,           BT uFloat128,
     283                                      BT uFloat128Complex,          BT uuFloat128,          BT LongDouble,   BT LongDoubleComplex,          BT uFloat128x,   BT uFloat128xComplex,
     284                                  },
     285                                  {
     286                /*    IB*/        BT SignedInt128,        BT SignedInt128,        BT SignedInt128,        BT SignedInt128,        BT SignedInt128,        BT SignedInt128,
     287                                          BT SignedInt128,        BT SignedInt128,        BT SignedInt128,        BT SignedInt128,        BT SignedInt128,        BT SignedInt128,
     288                                          BT SignedInt128,      BT UnsignedInt128,            BT uFloat16,     BT uFloat16Complex,            BT uFloat32,     BT uFloat32Complex,
     289                                                 BT Float,        BT FloatComplex,           BT uFloat32x,    BT uFloat32xComplex,            BT uFloat64,     BT uFloat64Complex,
     290                                                BT Double,       BT DoubleComplex,           BT uFloat64x,    BT uFloat64xComplex,           BT uuFloat80,           BT uFloat128,
     291                                      BT uFloat128Complex,          BT uuFloat128,          BT LongDouble,   BT LongDoubleComplex,          BT uFloat128x,   BT uFloat128xComplex,
     292                                  },
     293                                  {
     294                /*   UIB*/      BT UnsignedInt128,      BT UnsignedInt128,      BT UnsignedInt128,      BT UnsignedInt128,      BT UnsignedInt128,      BT UnsignedInt128,
     295                                        BT UnsignedInt128,      BT UnsignedInt128,      BT UnsignedInt128,      BT UnsignedInt128,      BT UnsignedInt128,      BT UnsignedInt128,
     296                                        BT UnsignedInt128,      BT UnsignedInt128,            BT uFloat16,     BT uFloat16Complex,            BT uFloat32,     BT uFloat32Complex,
     297                                                 BT Float,        BT FloatComplex,           BT uFloat32x,    BT uFloat32xComplex,            BT uFloat64,     BT uFloat64Complex,
     298                                                BT Double,       BT DoubleComplex,           BT uFloat64x,    BT uFloat64xComplex,           BT uuFloat80,           BT uFloat128,
     299                                      BT uFloat128Complex,          BT uuFloat128,          BT LongDouble,   BT LongDoubleComplex,          BT uFloat128x,   BT uFloat128xComplex,
     300                                  },
     301                                  {
     302                /*   _FH*/            BT uFloat16,            BT uFloat16,            BT uFloat16,            BT uFloat16,            BT uFloat16,            BT uFloat16,
     303                                              BT uFloat16,            BT uFloat16,            BT uFloat16,            BT uFloat16,            BT uFloat16,            BT uFloat16,
     304                                              BT uFloat16,            BT uFloat16,            BT uFloat16,     BT uFloat16Complex,            BT uFloat32,     BT uFloat32Complex,
     305                                                 BT Float,        BT FloatComplex,           BT uFloat32x,    BT uFloat32xComplex,            BT uFloat64,     BT uFloat64Complex,
     306                                                BT Double,       BT DoubleComplex,           BT uFloat64x,    BT uFloat64xComplex,           BT uuFloat80,           BT uFloat128,
     307                                      BT uFloat128Complex,          BT uuFloat128,          BT LongDouble,   BT LongDoubleComplex,          BT uFloat128x,   BT uFloat128xComplex,
     308                                  },
     309                                  {
     310                /*   _FH*/     BT uFloat16Complex,     BT uFloat16Complex,     BT uFloat16Complex,     BT uFloat16Complex,     BT uFloat16Complex,     BT uFloat16Complex,
     311                                       BT uFloat16Complex,     BT uFloat16Complex,     BT uFloat16Complex,     BT uFloat16Complex,     BT uFloat16Complex,     BT uFloat16Complex,
     312                                       BT uFloat16Complex,     BT uFloat16Complex,     BT uFloat16Complex,     BT uFloat16Complex,     BT uFloat32Complex,     BT uFloat32Complex,
     313                                          BT FloatComplex,        BT FloatComplex,    BT uFloat32xComplex,    BT uFloat32xComplex,     BT uFloat64Complex,     BT uFloat64Complex,
     314                                         BT DoubleComplex,       BT DoubleComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat128Complex,
     315                                      BT uFloat128Complex,    BT uFloat128Complex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,
     316                                  },
     317                                  {
     318                /*    _F*/            BT uFloat32,            BT uFloat32,            BT uFloat32,            BT uFloat32,            BT uFloat32,            BT uFloat32,
     319                                              BT uFloat32,            BT uFloat32,            BT uFloat32,            BT uFloat32,            BT uFloat32,            BT uFloat32,
     320                                              BT uFloat32,            BT uFloat32,            BT uFloat32,     BT uFloat32Complex,            BT uFloat32,     BT uFloat32Complex,
     321                                                 BT Float,        BT FloatComplex,           BT uFloat32x,    BT uFloat32xComplex,            BT uFloat64,     BT uFloat64Complex,
     322                                                BT Double,       BT DoubleComplex,           BT uFloat64x,    BT uFloat64xComplex,           BT uuFloat80,           BT uFloat128,
     323                                      BT uFloat128Complex,          BT uuFloat128,          BT LongDouble,   BT LongDoubleComplex,          BT uFloat128x,   BT uFloat128xComplex,
     324                                  },
     325                                  {
     326                /*   _FC*/     BT uFloat32Complex,     BT uFloat32Complex,     BT uFloat32Complex,     BT uFloat32Complex,     BT uFloat32Complex,     BT uFloat32Complex,
     327                                       BT uFloat32Complex,     BT uFloat32Complex,     BT uFloat32Complex,     BT uFloat32Complex,     BT uFloat32Complex,     BT uFloat32Complex,
     328                                       BT uFloat32Complex,     BT uFloat32Complex,     BT uFloat32Complex,     BT uFloat32Complex,     BT uFloat32Complex,     BT uFloat32Complex,
     329                                          BT FloatComplex,        BT FloatComplex,    BT uFloat32xComplex,    BT uFloat32xComplex,     BT uFloat64Complex,     BT uFloat64Complex,
     330                                         BT DoubleComplex,       BT DoubleComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat128Complex,
     331                                      BT uFloat128Complex,    BT uFloat128Complex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,
     332                                  },
     333                                  {
     334                /*     F*/               BT Float,               BT Float,               BT Float,               BT Float,               BT Float,               BT Float,
     335                                                 BT Float,               BT Float,               BT Float,               BT Float,               BT Float,               BT Float,
     336                                                 BT Float,               BT Float,               BT Float,        BT FloatComplex,               BT Float,        BT FloatComplex,
     337                                                 BT Float,        BT FloatComplex,           BT uFloat32x,    BT uFloat32xComplex,            BT uFloat64,     BT uFloat64Complex,
     338                                                BT Double,       BT DoubleComplex,           BT uFloat64x,    BT uFloat64xComplex,           BT uuFloat80,           BT uFloat128,
     339                                      BT uFloat128Complex,          BT uuFloat128,          BT LongDouble,   BT LongDoubleComplex,          BT uFloat128x,   BT uFloat128xComplex,
     340                                  },
     341                                  {
     342                /*    FC*/        BT FloatComplex,        BT FloatComplex,        BT FloatComplex,        BT FloatComplex,        BT FloatComplex,        BT FloatComplex,
     343                                          BT FloatComplex,        BT FloatComplex,        BT FloatComplex,        BT FloatComplex,        BT FloatComplex,        BT FloatComplex,
     344                                          BT FloatComplex,        BT FloatComplex,        BT FloatComplex,        BT FloatComplex,        BT FloatComplex,        BT FloatComplex,
     345                                          BT FloatComplex,        BT FloatComplex,    BT uFloat32xComplex,    BT uFloat32xComplex,     BT uFloat64Complex,     BT uFloat64Complex,
     346                                         BT DoubleComplex,       BT DoubleComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat128Complex,
     347                                      BT uFloat128Complex,    BT uFloat128Complex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,
     348                                  },
     349                                  {
     350                /*   _FX*/           BT uFloat32x,           BT uFloat32x,           BT uFloat32x,           BT uFloat32x,           BT uFloat32x,           BT uFloat32x,
     351                                             BT uFloat32x,           BT uFloat32x,           BT uFloat32x,           BT uFloat32x,           BT uFloat32x,           BT uFloat32x,
     352                                             BT uFloat32x,           BT uFloat32x,           BT uFloat32x,    BT uFloat32xComplex,           BT uFloat32x,    BT uFloat32xComplex,
     353                                             BT uFloat32x,    BT uFloat32xComplex,           BT uFloat32x,    BT uFloat32xComplex,            BT uFloat64,     BT uFloat64Complex,
     354                                                BT Double,       BT DoubleComplex,           BT uFloat64x,    BT uFloat64xComplex,           BT uuFloat80,           BT uFloat128,
     355                                      BT uFloat128Complex,          BT uuFloat128,          BT LongDouble,   BT LongDoubleComplex,          BT uFloat128x,   BT uFloat128xComplex,
     356                                  },
     357                                  {
     358                /*  _FXC*/    BT uFloat32xComplex,    BT uFloat32xComplex,    BT uFloat32xComplex,    BT uFloat32xComplex,    BT uFloat32xComplex,    BT uFloat32xComplex,
     359                                      BT uFloat32xComplex,    BT uFloat32xComplex,    BT uFloat32xComplex,    BT uFloat32xComplex,    BT uFloat32xComplex,    BT uFloat32xComplex,
     360                                      BT uFloat32xComplex,    BT uFloat32xComplex,    BT uFloat32xComplex,    BT uFloat32xComplex,    BT uFloat32xComplex,    BT uFloat32xComplex,
     361                                      BT uFloat32xComplex,    BT uFloat32xComplex,    BT uFloat32xComplex,    BT uFloat32xComplex,     BT uFloat64Complex,     BT uFloat64Complex,
     362                                         BT DoubleComplex,       BT DoubleComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat128Complex,
     363                                      BT uFloat128Complex,    BT uFloat128Complex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,
     364                                  },
     365                                  {
     366                /*    FD*/            BT uFloat64,            BT uFloat64,            BT uFloat64,            BT uFloat64,            BT uFloat64,            BT uFloat64,
     367                                              BT uFloat64,            BT uFloat64,            BT uFloat64,            BT uFloat64,            BT uFloat64,            BT uFloat64,
     368                                              BT uFloat64,            BT uFloat64,            BT uFloat64,     BT uFloat64Complex,            BT uFloat64,     BT uFloat64Complex,
     369                                              BT uFloat64,     BT uFloat64Complex,            BT uFloat64,     BT uFloat64Complex,            BT uFloat64,     BT uFloat64Complex,
     370                                                BT Double,       BT DoubleComplex,           BT uFloat64x,    BT uFloat64xComplex,           BT uuFloat80,           BT uFloat128,
     371                                      BT uFloat128Complex,          BT uuFloat128,          BT LongDouble,   BT LongDoubleComplex,          BT uFloat128x,   BT uFloat128xComplex,
     372                                  },
     373                                  {
     374                /*  _FDC*/     BT uFloat64Complex,     BT uFloat64Complex,     BT uFloat64Complex,     BT uFloat64Complex,     BT uFloat64Complex,     BT uFloat64Complex,
     375                                       BT uFloat64Complex,     BT uFloat64Complex,     BT uFloat64Complex,     BT uFloat64Complex,     BT uFloat64Complex,     BT uFloat64Complex,
     376                                       BT uFloat64Complex,     BT uFloat64Complex,     BT uFloat64Complex,     BT uFloat64Complex,     BT uFloat64Complex,     BT uFloat64Complex,
     377                                       BT uFloat64Complex,     BT uFloat64Complex,     BT uFloat64Complex,     BT uFloat64Complex,     BT uFloat64Complex,     BT uFloat64Complex,
     378                                         BT DoubleComplex,       BT DoubleComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat128Complex,
     379                                      BT uFloat128Complex,    BT uFloat128Complex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,
     380                                  },
     381                                  {
     382                /*     D*/              BT Double,              BT Double,              BT Double,              BT Double,              BT Double,              BT Double,
     383                                                BT Double,              BT Double,              BT Double,              BT Double,              BT Double,              BT Double,
     384                                                BT Double,              BT Double,              BT Double,       BT DoubleComplex,              BT Double,       BT DoubleComplex,
     385                                                BT Double,       BT DoubleComplex,              BT Double,       BT DoubleComplex,              BT Double,       BT DoubleComplex,
     386                                                BT Double,       BT DoubleComplex,           BT uFloat64x,    BT uFloat64xComplex,           BT uuFloat80,           BT uFloat128,
     387                                      BT uFloat128Complex,          BT uuFloat128,          BT LongDouble,   BT LongDoubleComplex,          BT uFloat128x,   BT uFloat128xComplex,
     388                                  },
     389                                  {
     390                /*    DC*/       BT DoubleComplex,       BT DoubleComplex,       BT DoubleComplex,       BT DoubleComplex,       BT DoubleComplex,       BT DoubleComplex,
     391                                         BT DoubleComplex,       BT DoubleComplex,       BT DoubleComplex,       BT DoubleComplex,       BT DoubleComplex,       BT DoubleComplex,
     392                                         BT DoubleComplex,       BT DoubleComplex,       BT DoubleComplex,       BT DoubleComplex,       BT DoubleComplex,       BT DoubleComplex,
     393                                         BT DoubleComplex,       BT DoubleComplex,       BT DoubleComplex,       BT DoubleComplex,       BT DoubleComplex,       BT DoubleComplex,
     394                                         BT DoubleComplex,       BT DoubleComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat128Complex,
     395                                      BT uFloat128Complex,    BT uFloat128Complex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,
     396                                  },
     397                                  {
     398                /*  F80X*/           BT uFloat64x,           BT uFloat64x,           BT uFloat64x,           BT uFloat64x,           BT uFloat64x,           BT uFloat64x,
     399                                             BT uFloat64x,           BT uFloat64x,           BT uFloat64x,           BT uFloat64x,           BT uFloat64x,           BT uFloat64x,
     400                                             BT uFloat64x,           BT uFloat64x,           BT uFloat64x,    BT uFloat64xComplex,           BT uFloat64x,    BT uFloat64xComplex,
     401                                             BT uFloat64x,    BT uFloat64xComplex,           BT uFloat64x,    BT uFloat64xComplex,           BT uFloat64x,    BT uFloat64xComplex,
     402                                             BT uFloat64x,    BT uFloat64xComplex,           BT uFloat64x,    BT uFloat64xComplex,           BT uuFloat80,           BT uFloat128,
     403                                      BT uFloat128Complex,          BT uuFloat128,          BT LongDouble,   BT LongDoubleComplex,          BT uFloat128x,   BT uFloat128xComplex,
     404                                  },
     405                                  {
     406                /* _FDXC*/    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,
     407                                      BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,
     408                                      BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,
     409                                      BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,
     410                                      BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat64xComplex,    BT uFloat128Complex,
     411                                      BT uFloat128Complex,    BT uFloat128Complex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,
     412                                  },
     413                                  {
     414                /*   F80*/           BT uuFloat80,           BT uuFloat80,           BT uuFloat80,           BT uuFloat80,           BT uuFloat80,           BT uuFloat80,
     415                                             BT uuFloat80,           BT uuFloat80,           BT uuFloat80,           BT uuFloat80,           BT uuFloat80,           BT uuFloat80,
     416                                             BT uuFloat80,           BT uuFloat80,           BT uuFloat80,    BT uFloat64xComplex,           BT uuFloat80,    BT uFloat64xComplex,
     417                                             BT uuFloat80,    BT uFloat64xComplex,           BT uuFloat80,    BT uFloat64xComplex,           BT uuFloat80,    BT uFloat64xComplex,
     418                                             BT uuFloat80,    BT uFloat64xComplex,           BT uuFloat80,    BT uFloat64xComplex,           BT uuFloat80,           BT uFloat128,
     419                                      BT uFloat128Complex,          BT uuFloat128,          BT LongDouble,   BT LongDoubleComplex,          BT uFloat128x,   BT uFloat128xComplex,
     420                                  },
     421                                  {
     422                /*   _FB*/           BT uFloat128,           BT uFloat128,           BT uFloat128,           BT uFloat128,           BT uFloat128,           BT uFloat128,
     423                                             BT uFloat128,           BT uFloat128,           BT uFloat128,           BT uFloat128,           BT uFloat128,           BT uFloat128,
     424                                             BT uFloat128,           BT uFloat128,           BT uFloat128,    BT uFloat128Complex,           BT uFloat128,    BT uFloat128Complex,
     425                                             BT uFloat128,    BT uFloat128Complex,           BT uFloat128,    BT uFloat128Complex,           BT uFloat128,    BT uFloat128Complex,
     426                                             BT uFloat128,    BT uFloat128Complex,           BT uFloat128,    BT uFloat128Complex,           BT uFloat128,           BT uFloat128,
     427                                      BT uFloat128Complex,          BT uuFloat128,          BT LongDouble,   BT LongDoubleComplex,          BT uFloat128x,   BT uFloat128xComplex,
     428                                  },
     429                                  {
     430                /* _FLDC*/    BT uFloat128Complex,    BT uFloat128Complex,    BT uFloat128Complex,    BT uFloat128Complex,    BT uFloat128Complex,    BT uFloat128Complex,
     431                                      BT uFloat128Complex,    BT uFloat128Complex,    BT uFloat128Complex,    BT uFloat128Complex,    BT uFloat128Complex,    BT uFloat128Complex,
     432                                      BT uFloat128Complex,    BT uFloat128Complex,    BT uFloat128Complex,    BT uFloat128Complex,    BT uFloat128Complex,    BT uFloat128Complex,
     433                                      BT uFloat128Complex,    BT uFloat128Complex,    BT uFloat128Complex,    BT uFloat128Complex,    BT uFloat128Complex,    BT uFloat128Complex,
     434                                      BT uFloat128Complex,    BT uFloat128Complex,    BT uFloat128Complex,    BT uFloat128Complex,    BT uFloat128Complex,    BT uFloat128Complex,
     435                                      BT uFloat128Complex,    BT uFloat128Complex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,
     436                                  },
     437                                  {
     438                /*    FB*/          BT uuFloat128,          BT uuFloat128,          BT uuFloat128,          BT uuFloat128,          BT uuFloat128,          BT uuFloat128,
     439                                            BT uuFloat128,          BT uuFloat128,          BT uuFloat128,          BT uuFloat128,          BT uuFloat128,          BT uuFloat128,
     440                                            BT uuFloat128,          BT uuFloat128,          BT uuFloat128,    BT uFloat128Complex,          BT uuFloat128,    BT uFloat128Complex,
     441                                            BT uuFloat128,    BT uFloat128Complex,          BT uuFloat128,    BT uFloat128Complex,          BT uuFloat128,    BT uFloat128Complex,
     442                                            BT uuFloat128,    BT uFloat128Complex,          BT uuFloat128,    BT uFloat128Complex,          BT uuFloat128,          BT uuFloat128,
     443                                      BT uFloat128Complex,          BT uuFloat128,          BT LongDouble,   BT LongDoubleComplex,          BT uFloat128x,   BT uFloat128xComplex,
     444                                  },
     445                                  {
     446                /*    LD*/          BT LongDouble,          BT LongDouble,          BT LongDouble,          BT LongDouble,          BT LongDouble,          BT LongDouble,
     447                                            BT LongDouble,          BT LongDouble,          BT LongDouble,          BT LongDouble,          BT LongDouble,          BT LongDouble,
     448                                            BT LongDouble,          BT LongDouble,          BT LongDouble,   BT LongDoubleComplex,          BT LongDouble,   BT LongDoubleComplex,
     449                                            BT LongDouble,   BT LongDoubleComplex,          BT LongDouble,   BT LongDoubleComplex,          BT LongDouble,   BT LongDoubleComplex,
     450                                            BT LongDouble,   BT LongDoubleComplex,          BT LongDouble,   BT LongDoubleComplex,          BT LongDouble,          BT LongDouble,
     451                                     BT LongDoubleComplex,          BT LongDouble,          BT LongDouble,   BT LongDoubleComplex,          BT uFloat128x,   BT uFloat128xComplex,
     452                                  },
     453                                  {
     454                /*   LDC*/   BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,
     455                                     BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,
     456                                     BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,
     457                                     BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,
     458                                     BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,
     459                                     BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT LongDoubleComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,
     460                                  },
     461                                  {
     462                /*  _FBX*/          BT uFloat128x,          BT uFloat128x,          BT uFloat128x,          BT uFloat128x,          BT uFloat128x,          BT uFloat128x,
     463                                            BT uFloat128x,          BT uFloat128x,          BT uFloat128x,          BT uFloat128x,          BT uFloat128x,          BT uFloat128x,
     464                                            BT uFloat128x,          BT uFloat128x,          BT uFloat128x,   BT uFloat128xComplex,          BT uFloat128x,   BT uFloat128xComplex,
     465                                            BT uFloat128x,   BT uFloat128xComplex,          BT uFloat128x,   BT uFloat128xComplex,          BT uFloat128x,   BT uFloat128xComplex,
     466                                            BT uFloat128x,   BT uFloat128xComplex,          BT uFloat128x,   BT uFloat128xComplex,          BT uFloat128x,          BT uFloat128x,
     467                                     BT uFloat128xComplex,          BT uFloat128x,          BT uFloat128x,   BT uFloat128xComplex,          BT uFloat128x,   BT uFloat128xComplex,
     468                                  },
     469                                  {
     470                /*_FLDXC*/   BT uFloat128xComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,
     471                                     BT uFloat128xComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,
     472                                     BT uFloat128xComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,
     473                                     BT uFloat128xComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,
     474                                     BT uFloat128xComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,
     475                                     BT uFloat128xComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,   BT uFloat128xComplex,
     476                                  },
     477        }; // commonTypes
     478        #undef BT
     479        // GENERATED END
    207480        static_assert(
    208                 sizeof(combinedType)/sizeof(combinedType[0][0]) == BasicType::NUMBER_OF_BASIC_TYPES*BasicType::NUMBER_OF_BASIC_TYPES,
     481                sizeof(commonTypes)/sizeof(commonTypes[0][0]) == BasicType::NUMBER_OF_BASIC_TYPES*BasicType::NUMBER_OF_BASIC_TYPES,
    209482                "Each basic type kind should have a corresponding row in the combined type matrix"
    210483        );
     
    218491        void CommonType::postvisit( BasicType *basicType ) {
    219492                if ( BasicType *otherBasic = dynamic_cast< BasicType* >( type2 ) ) {
    220                         BasicType::Kind newType = combinedType[ basicType->get_kind() ][ otherBasic->get_kind() ];
     493                        BasicType::Kind newType = commonTypes[ basicType->get_kind() ][ otherBasic->get_kind() ];
    221494                        if ( ( ( newType == basicType->get_kind() && basicType->get_qualifiers() >= otherBasic->get_qualifiers() ) || widenFirst ) && ( ( newType == otherBasic->get_kind() && basicType->get_qualifiers() <= otherBasic->get_qualifiers() ) || widenSecond ) ) {
    222495                                result = new BasicType( basicType->get_qualifiers() | otherBasic->get_qualifiers(), newType );
     
    224497                } else if ( dynamic_cast< EnumInstType * > ( type2 ) || dynamic_cast< ZeroType* >( type2 ) || dynamic_cast< OneType* >( type2 ) ) {
    225498                        // use signed int in lieu of the enum/zero/one type
    226                         BasicType::Kind newType = combinedType[ basicType->get_kind() ][ BasicType::SignedInt ];
     499                        BasicType::Kind newType = commonTypes[ basicType->get_kind() ][ BasicType::SignedInt ];
    227500                        if ( ( ( newType == basicType->get_kind() && basicType->get_qualifiers() >= type2->get_qualifiers() ) || widenFirst ) && ( ( newType != basicType->get_kind() && basicType->get_qualifiers() <= type2->get_qualifiers() ) || widenSecond ) ) {
    228501                                result = new BasicType( basicType->get_qualifiers() | type2->get_qualifiers(), newType );
  • src/ResolvExpr/ConversionCost.cc

    r9d9a451 r53bb8f1  
    1010// Created On       : Sun May 17 07:06:19 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Sep 25 15:43:34 2017
    13 // Update Count     : 10
     12// Last Modified On : Thu Feb 14 17:04:31 2019
     13// Update Count     : 23
    1414//
    1515
     
    2828
    2929namespace ResolvExpr {
    30         const Cost Cost::zero =      Cost{  0,  0,  0,  0,  0,  0 };
    31         const Cost Cost::infinity =  Cost{ -1, -1, -1, -1,  1, -1 };
    32         const Cost Cost::unsafe =    Cost{  1,  0,  0,  0,  0,  0 };
    33         const Cost Cost::poly =      Cost{  0,  1,  0,  0,  0,  0 };
    34         const Cost Cost::safe =      Cost{  0,  0,  1,  0,  0,  0 };
    35         const Cost Cost::var =       Cost{  0,  0,  0,  1,  0,  0 };
    36         const Cost Cost::spec =      Cost{  0,  0,  0,  0, -1,  0 };
    37         const Cost Cost::reference = Cost{  0,  0,  0,  0,  0,  1 };
     30        const Cost Cost::zero =      Cost{  0,  0,  0,  0,  0,  0,  0 };
     31        const Cost Cost::infinity =  Cost{ -1, -1, -1, -1, -1,  1, -1 };
     32        const Cost Cost::unsafe =    Cost{  1,  0,  0,  0,  0,  0,  0 };
     33        const Cost Cost::poly =      Cost{  0,  1,  0,  0,  0,  0,  0 };
     34        const Cost Cost::safe =      Cost{  0,  0,  1,  0,  0,  0,  0 };
     35        const Cost Cost::sign =      Cost{  0,  0,  0,  1,  0,  0,  0 };
     36        const Cost Cost::var =       Cost{  0,  0,  0,  0,  1,  0,  0 };
     37        const Cost Cost::spec =      Cost{  0,  0,  0,  0,  0, -1,  0 };
     38        const Cost Cost::reference = Cost{  0,  0,  0,  0,  0,  0,  1 };
    3839
    3940#if 0
     
    4243#define PRINT(x)
    4344#endif
     45
    4446        Cost conversionCost( Type *src, Type *dest, const SymTab::Indexer &indexer, const TypeEnvironment &env ) {
    4547                if ( TypeInstType *destAsTypeInst = dynamic_cast< TypeInstType* >( dest ) ) {
     
    179181        }
    180182
    181 /*
    182             Old
    183             ===
    184            Double
    185              |
    186            Float
    187              |
    188            ULong
    189            /   \
    190         UInt    Long
    191            \   /
    192             Int
    193              |
    194            Ushort
    195              |
    196            Short
    197              |
    198            Uchar
    199            /   \
    200         Schar   Char
    201 
    202                                 New
    203                                 ===
    204                        +-----LongDoubleComplex--+
    205            LongDouble--+          |             +-LongDoubleImag
    206              |         +---DoubleComplex---+         |
    207            Double------+        |          +----DoubleImag
    208              |           +-FloatComplex-+            |
    209            Float---------+              +-------FloatImag
    210              |
    211           ULongLong
    212              |
    213           LongLong
    214              |
    215            ULong
    216            /   \
    217         UInt    Long
    218            \   /
    219             Int
    220              |
    221            Ushort
    222              |
    223            Short
    224              |
    225            Uchar
    226            /   \
    227         Schar   Char
    228            \   /
    229             Bool
    230 */
    231 
    232         static const int costMatrix[][ BasicType::NUMBER_OF_BASIC_TYPES ] = {
    233         /* Src \ Dest:  Bool    Char    SChar   UChar   Short   UShort  Int     UInt    Long    ULong   LLong   ULLong  Float   Double  LDbl    FCplex  DCplex  LDCplex FImag   DImag   LDImag  I128,   U128, F80, F128 */
    234                 /* Bool */      { 0,    1,              1,              2,              3,              4,              5,              6,              6,              7,              8,              9,              12,             13,             14,             12,             13,             14,             -1,             -1,             -1,             10,             11,       14,   15},
    235                 /* Char */      { -1,   0,              -1,             1,              2,              3,              4,              5,              5,              6,              7,              8,              11,             12,             13,             11,             12,             13,             -1,             -1,             -1,             9,              10,       13,   14},
    236                 /* SChar */ { -1,       -1,             0,              1,              2,              3,              4,              5,              5,              6,              7,              8,              11,             12,             13,             11,             12,             13,             -1,             -1,             -1,             9,              10,       13,   14},
    237                 /* UChar */ { -1,       -1,             -1,             0,              1,              2,              3,              4,              4,              5,              6,              7,              10,             11,             12,             10,             11,             12,             -1,             -1,             -1,             8,              9,        12,   13},
    238                 /* Short */ { -1,       -1,             -1,             -1,             0,              1,              2,              3,              3,              4,              5,              6,              9,              10,             11,             9,              10,             11,             -1,             -1,             -1,             7,              8,        11,   12},
    239                 /* UShort */{ -1,       -1,             -1,             -1,             -1,             0,              1,              2,              2,              3,              4,              5,              8,              9,              10,             8,              9,              10,             -1,             -1,             -1,             6,              7,        10,   11},
    240                 /* Int */       { -1,   -1,             -1,             -1,             -1,             -1,             0,              1,              1,              2,              3,              4,              7,              8,              9,              7,              8,              9,              -1,             -1,             -1,             5,              6,        9,    10},
    241                 /* UInt */      { -1,   -1,             -1,             -1,             -1,             -1,             -1,             0,              -1,             1,              2,              3,              6,              7,              8,              6,              7,              8,              -1,             -1,             -1,             4,              5,        8,    9},
    242                 /* Long */      { -1,   -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              2,              3,              6,              7,              8,              6,              7,              8,              -1,             -1,             -1,             4,              5,        8,    9},
    243                 /* ULong */ { -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              2,              5,              6,              7,              5,              6,              7,              -1,             -1,             -1,             3,              4,        7,    8},
    244                 /* LLong */ { -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              4,              5,              6,              4,              5,              6,              -1,             -1,             -1,             2,              3,        6,    7},
    245                 /* ULLong */{ -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              3,              4,              5,              3,              4,              5,              -1,             -1,             -1,             1,              2,        5,    6},
    246 
    247                 /* Float */ { -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              2,              1,              2,              3,              -1,             -1,             -1,             -1,             -1,       2,    3},
    248                 /* Double */{ -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              -1,             1,              2,              -1,             -1,             -1,             -1,             -1,       1,    2},
    249                 /* LDbl */      { -1,   -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              -1,             -1,             1,              -1,             -1,             -1,             -1,             -1,       -1,   1},
    250                 /* FCplex */{ -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              2,              -1,             -1,             -1,             -1,             -1,       -1,   -1},
    251                 /* DCplex */{ -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              1,              -1,             -1,             -1,             -1,             -1,       -1,   -1},
    252                 /* LDCplex */{ -1,      -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             0,              -1,             -1,             -1,             -1,             -1,       -1,   -1},
    253                 /* FImag */ { -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             1,              2,              3,              0,              1,              2,              -1,             -1,       -1,   -1},
    254                 /* DImag */ { -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             1,              2,              -1,             0,              1,              -1,             -1,       -1,   -1},
    255                 /* LDImag */{ -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},
    256 
    257                 /* I128 */  { -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             2,              3,              4,              3,              4,              5,              -1,             -1,             -1,             0,              1,        4,    4},
    258                 /* U128 */  { -1,       -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             -1,             1,              2,              3,              2,              3,              4,              -1,             -1,             -1,             -1,             0,        3,    3},
    259 
    260                 /* F80 */       { -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},
    261                 /* F128 */      { -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},
    262         };
     183        // GENERATED START, DO NOT EDIT
     184        // GENERATED BY BasicTypes-gen.cc
     185        /* EXTENDED INTEGRAL RANK HIERARCHY (root to leaves)
     186                                 _Bool
     187        char                signed char         unsigned char       
     188                  signed short int         unsigned short int       
     189                  signed int               unsigned int             
     190                  signed long int          unsigned long int       
     191                  signed long long int     unsigned long long int   
     192                  __int128                 unsigned __int128       
     193                  _Float16                 _Float16 _Complex       
     194                  _Float32                 _Float32 _Complex       
     195                  float                    float _Complex           
     196                  _Float32x                _Float32x _Complex       
     197                  _Float64                 _Float64 _Complex       
     198                  double                   double _Complex         
     199                  _Float64x                _Float64x _Complex       
     200                             __float80
     201                  _Float128                _Float128 _Complex       
     202                            __float128
     203                  long double              long double _Complex     
     204                  _Float128x               _Float128x _Complex     
     205        */
     206        // GENERATED END
     207
     208        // GENERATED START, DO NOT EDIT
     209        // GENERATED BY BasicTypes-gen.cc
     210        static const int costMatrix[BasicType::NUMBER_OF_BASIC_TYPES][BasicType::NUMBER_OF_BASIC_TYPES] = { // path length from root to node
     211                /*             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 */
     212                /*     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, },
     213                /*     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, },
     214                /*    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, },
     215                /*    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, },
     216                /*    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, },
     217                /*   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, },
     218                /*     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, },
     219                /*    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, },
     220                /*    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, },
     221                /*   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, },
     222                /*   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, },
     223                /*  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, },
     224                /*    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, },
     225                /*   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, },
     226                /*   _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, },
     227                /*   _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, },
     228                /*    _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, },
     229                /*   _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, },
     230                /*     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, },
     231                /*    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, },
     232                /*   _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, },
     233                /*  _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, },
     234                /*    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, },
     235                /*  _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, },
     236                /*     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, },
     237                /*    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, },
     238                /*  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, },
     239                /* _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, },
     240                /*   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, },
     241                /*   _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, },
     242                /* _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, },
     243                /*    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, },
     244                /*    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, },
     245                /*   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, },
     246                /*  _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, },
     247                /*_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, },
     248        }; // costMatrix
     249        // GENERATED END
    263250        static_assert(
    264251                sizeof(costMatrix)/sizeof(costMatrix[0][0]) == BasicType::NUMBER_OF_BASIC_TYPES*BasicType::NUMBER_OF_BASIC_TYPES,
    265                 "Each basic type kind should have a corresponding row in the cost matrix"
     252                "Missing row in the cost matrix"
    266253        );
    267254
     255        // GENERATED START, DO NOT EDIT
     256        // GENERATED BY BasicTypes-gen.cc
     257        static const int signMatrix[BasicType::NUMBER_OF_BASIC_TYPES][BasicType::NUMBER_OF_BASIC_TYPES] = { // number of sign changes in safe conversion
     258                /*             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 */
     259                /*     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, },
     260                /*     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, },
     261                /*    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, },
     262                /*    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, },
     263                /*    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, },
     264                /*   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, },
     265                /*     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, },
     266                /*    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, },
     267                /*    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, },
     268                /*   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, },
     269                /*   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, },
     270                /*  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, },
     271                /*    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, },
     272                /*   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, },
     273                /*   _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, },
     274                /*   _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, },
     275                /*    _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, },
     276                /*   _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, },
     277                /*     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, },
     278                /*    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, },
     279                /*   _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, },
     280                /*  _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, },
     281                /*    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, },
     282                /*  _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, },
     283                /*     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, },
     284                /*    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, },
     285                /*  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, },
     286                /* _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, },
     287                /*   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, },
     288                /*   _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, },
     289                /* _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, },
     290                /*    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, },
     291                /*    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, },
     292                /*   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, },
     293                /*  _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, },
     294                /*_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, },
     295        }; // signMatrix
     296        // GENERATED END
     297        static_assert(
     298                sizeof(signMatrix)/sizeof(signMatrix[0][0]) == BasicType::NUMBER_OF_BASIC_TYPES*BasicType::NUMBER_OF_BASIC_TYPES,
     299                "Missing row in the sign matrix"
     300        );
    268301
    269302        void ConversionCost::postvisit( VoidType * ) {
     
    279312                                cost = Cost::zero;
    280313                                cost.incSafe( tableResult );
     314                                cost.incSign( signMatrix[ basicType->get_kind() ][ destAsBasic->get_kind() ] );
    281315                        } // if
    282316                } else if ( dynamic_cast< EnumInstType *>( dest ) ) {
     
    300334                                        // types are the same, except otherPointer has more qualifiers
    301335                                        cost = Cost::safe;
    302                                 }
     336                                } // if
    303337                        } else {
    304338                                int assignResult = ptrsAssignable( pointerType->base, destAsPtr->base, env );
     
    422456                                cost = Cost::zero;
    423457                                cost.incSafe( tableResult + 1 );
    424                         }
     458                                cost.incSign( signMatrix[ BasicType::SignedInt ][ destAsBasic->get_kind() ] );
     459                        } // if
    425460                } else if ( dynamic_cast< PointerType* >( dest ) ) {
    426461                        cost = Cost::safe;
    427                 }
     462                } // if
    428463        }
    429464
     
    439474                                cost = Cost::zero;
    440475                                cost.incSafe( tableResult + 1 );
    441                         }
    442                 }
     476                                cost.incSign( signMatrix[ BasicType::SignedInt ][ destAsBasic->get_kind() ] );
     477                        } // if
     478                } // if
    443479        }
    444480} // namespace ResolvExpr
  • src/ResolvExpr/Cost.h

    r9d9a451 r53bb8f1  
    99// Author           : Richard C. Bilson
    1010// Created On       : Sun May 17 09:39:50 2015
    11 // Last Modified By : Aaron B. Moss
    12 // Last Modified On : Fri Oct 05 14:32:00 2018
    13 // Update Count     : 7
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Thu Feb  7 20:54:29 2019
     13// Update Count     : 8
    1414//
    1515
     
    2121        class Cost {
    2222          private:
    23                 Cost( int unsafeCost, int polyCost, int safeCost, int varCost, int specCost,
    24                         int referenceCost );
    25 
     23                Cost( int unsafeCost, int polyCost, int safeCost, int signCost,
     24                        int varCost, int specCost, int referenceCost );
    2625          public:
    2726                Cost & incUnsafe( int inc = 1 );
    2827                Cost & incPoly( int inc = 1 );
    2928                Cost & incSafe( int inc = 1 );
     29                Cost & incSign( int inc = 1 );
    3030                Cost & incVar( int inc = 1 );
    3131                Cost & decSpec( int inc = 1 );
     
    3535                int get_polyCost() const { return polyCost; }
    3636                int get_safeCost() const { return safeCost; }
     37                int get_signCost() const { return signCost; }
    3738                int get_varCost() const { return varCost; }
    3839                int get_specCost() const { return specCost; }
     
    4041
    4142                Cost operator+( const Cost &other ) const;
    42                 Cost operator-( const Cost &other ) const;
    4343                Cost &operator+=( const Cost &other );
    4444                bool operator<( const Cost &other ) const;
     
    5555                static const Cost poly;
    5656                static const Cost safe;
     57                static const Cost sign;
    5758                static const Cost var;
    5859                static const Cost spec;
     
    6364                int polyCost;       ///< Count of parameters and return values bound to some poly type
    6465                int safeCost;       ///< Safe (widening) conversions
     66                int signCost;       ///< Count of safe sign conversions
    6567                int varCost;        ///< Count of polymorphic type variables
    6668                int specCost;       ///< Polymorphic type specializations (type assertions), negative cost
     
    6870        };
    6971
    70         inline Cost::Cost( int unsafeCost, int polyCost, int safeCost, int varCost, int specCost,
    71                         int referenceCost )
    72                 : unsafeCost( unsafeCost ), polyCost( polyCost ), safeCost( safeCost ), varCost( varCost ),
    73                   specCost( specCost ), referenceCost( referenceCost ) {}
     72        inline Cost::Cost( int unsafeCost, int polyCost, int safeCost, int signCost,
     73                        int varCost, int specCost, int referenceCost )
     74                : unsafeCost( unsafeCost ), polyCost( polyCost ), safeCost( safeCost ), signCost( signCost ),
     75                  varCost( varCost ), specCost( specCost ), referenceCost( referenceCost ) {}
    7476
    7577        inline Cost & Cost::incUnsafe( int inc ) {
     
    8890                if ( *this == infinity ) return *this;
    8991                safeCost += inc;
     92                return *this;
     93        }
     94
     95        inline Cost & Cost::incSign( int inc ) {
     96                if ( *this == infinity ) return *this;
     97                signCost += inc;
    9098                return *this;
    9199        }
     
    111119        inline Cost Cost::operator+( const Cost &other ) const {
    112120                if ( *this == infinity || other == infinity ) return infinity;
    113                 return Cost{ 
    114                         unsafeCost + other.unsafeCost, polyCost + other.polyCost, safeCost + other.safeCost, 
    115                         varCost + other.varCost, specCost + other.specCost,
     121                return Cost{
     122                        unsafeCost + other.unsafeCost, polyCost + other.polyCost, safeCost + other.safeCost,
     123                        signCost + other.signCost, varCost + other.varCost, specCost + other.specCost,
    116124                        referenceCost + other.referenceCost };
    117         }
    118 
    119         inline Cost Cost::operator-( const Cost &other ) const {
    120                 if ( *this == infinity || other == infinity ) return infinity;
    121                 return Cost{
    122                         unsafeCost - other.unsafeCost, polyCost - other.polyCost, safeCost - other.safeCost,
    123                         varCost - other.varCost, specCost - other.specCost,
    124                         referenceCost - other.referenceCost };
    125125        }
    126126
     
    134134                polyCost += other.polyCost;
    135135                safeCost += other.safeCost;
     136                signCost += other.signCost;
    136137                varCost += other.varCost;
    137138                specCost += other.specCost;
     
    156157                } else if ( safeCost < other.safeCost ) {
    157158                        return true;
     159                } else if ( signCost > other.signCost ) {
     160                        return false;
     161                } else if ( signCost < other.signCost ) {
     162                        return true;
    158163                } else if ( varCost > other.varCost ) {
    159164                        return false;
     
    180185                c = polyCost - other.polyCost; if ( c ) return c;
    181186                c = safeCost - other.safeCost; if ( c ) return c;
     187                c = signCost - other.signCost; if ( c ) return c;
    182188                c = varCost - other.varCost; if ( c ) return c;
    183189                c = specCost - other.specCost; if ( c ) return c;
     
    189195                        && polyCost == other.polyCost
    190196                        && safeCost == other.safeCost
     197                        && signCost == other.signCost
    191198                        && varCost == other.varCost
    192199                        && specCost == other.specCost
     
    199206
    200207        inline std::ostream &operator<<( std::ostream &os, const Cost &cost ) {
    201                 return os << "( " << cost.unsafeCost << ", " << cost.polyCost << ", "
    202                           << cost.safeCost << ", " << cost.varCost << ", " << cost.specCost << ", "
     208                return os << "( " << cost.unsafeCost << ", " << cost.polyCost << ", "
     209                          << cost.safeCost << ", " << cost.signCost << ", "
     210                                  << cost.varCost << ", " << cost.specCost << ", "
    203211                          << cost.referenceCost << " )";
    204212        }
  • src/ResolvExpr/ResolveAssertions.cc

    r9d9a451 r53bb8f1  
    2020#include <list>                     // for list
    2121#include <memory>                   // for unique_ptr
     22#include <string>
    2223#include <unordered_map>            // for unordered_map, unordered_multimap
    2324#include <utility>                  // for move
     
    5556        using CandidateList = std::vector<AssnCandidate>;
    5657
     58        /// Unique identifier for a yet-to-be-resolved assertion
     59        struct AssnId {
     60                DeclarationWithType* decl;  ///< Declaration of assertion
     61                AssertionSetValue info;     ///< Information about assertion
     62
     63                AssnId(DeclarationWithType* decl, const AssertionSetValue& info) : decl(decl), info(info) {}
     64        };
     65
     66        /// Cached assertion items
     67        struct AssnCacheItem {
     68                CandidateList matches;         ///< Possible matches for this assertion
     69                std::vector<AssnId> deferIds;  ///< Deferred assertions which resolve to this item
     70
     71                AssnCacheItem( CandidateList&& m ) : matches(std::move(m)), deferIds() {}
     72        };
     73
     74        /// Cache of resolved assertions
     75        using AssnCache = std::unordered_map<std::string, AssnCacheItem>;
     76
    5777        /// Reference to single deferred item
    5878        struct DeferRef {
    59                 const DeclarationWithType* decl;
    60                 const AssertionSetValue& info;
     79                const AssnCacheItem& item;
    6180                const AssnCandidate& match;
    6281        };
     
    6584        /// Acts like indexed list of DeferRef
    6685        struct DeferItem {
    67                 DeclarationWithType* decl;
    68                 AssertionSetValue info;
    69                 CandidateList matches;
    70 
    71                 DeferItem( DeclarationWithType* decl, const AssertionSetValue& info,
    72                         CandidateList&& matches )
    73                 : decl(decl), info(info), matches(std::move(matches)) {}
    74 
    75                 bool empty() const { return matches.empty(); }
    76 
    77                 CandidateList::size_type size() const { return matches.size(); }
    78 
    79                 DeferRef operator[] ( unsigned i ) const { return { decl, info, matches[i] }; }
     86                const AssnCache* cache;     ///< Cache storing assertion item
     87                std::string key;            ///< Key into cache
     88               
     89                DeferItem( const AssnCache& cache, const std::string& key ) : cache(&cache), key(key) {}
     90
     91                bool empty() const { return cache->at(key).matches.empty(); }
     92
     93                CandidateList::size_type size() const { return cache->at(key).matches.size(); }
     94
     95                DeferRef operator[] ( unsigned i ) const {
     96                        const AssnCacheItem& item = cache->at(key);
     97                        return { item, item.matches[i] };
     98                }
     99
     100                // sortable by key
     101                // TODO look into optimizing combination process with other sort orders (e.g. by number
     102                // of matches in candidate)
     103                bool operator< ( const DeferItem& o ) const { return key < o.key; }
     104                bool operator== ( const DeferItem& o ) const { return key == o.key; }
    80105        };
    81106
     
    152177                                for ( const auto& assn : x.assns ) {
    153178                                        k += computeConversionCost(
    154                                                 assn.match.adjType, assn.decl->get_type(), indexer, x.env );
     179                                                assn.match.adjType, assn.item.deferIds[0].decl->get_type(), indexer,
     180                                                x.env );
    155181                                }
    156182                                it = cache.emplace_hint( it, &x, k );
     
    208234                                candidate->get_uniqueId(), match.adjType->clone(), decl->get_type()->clone(),
    209235                                varExpr };
    210 
    211                 // // follow the current assertion's ID chain to find the correct set of inferred parameters
    212                 // // to add the candidate o (i.e. the set of inferred parameters belonging to the entity
    213                 // // which requested the assertion parameter)
    214                 // InferredParams* inferParams = &alt.expr->inferParams;
    215                 // for ( UniqueId id : info.idChain ) {
    216                 //      inferParams = (*inferParams)[ id ].inferParams.get();
    217                 // }
    218 
    219                 // (*inferParams)[ decl->get_uniqueId() ] = ParamEntry{
    220                 //              candidate->get_uniqueId(), match.adjType, decl->get_type()->clone(), varExpr };
    221236        }
    222237
    223238        /// Adds a captured assertion to the symbol table
    224239        void addToIndexer( AssertionSet &assertSet, SymTab::Indexer &indexer ) {
    225                 for ( AssertionSet::iterator i = assertSet.begin(); i != assertSet.end(); ++i ) {
    226                         if ( i->second.isUsed ) {
    227                                 indexer.addId( i->first );
     240                for ( auto&  i : assertSet ) {
     241                        if ( i.second.isUsed ) {
     242                                indexer.addId( i.first );
    228243                        }
    229244                }
     
    234249
    235250        /// Resolve a single assertion, in context
    236         bool resolveAssertion( AssertionItem& assn, ResnState& resn ) {
     251        bool resolveAssertion( AssertionItem& assn, ResnState& resn, AssnCache& cache ) {
    237252                // skip unused assertions
    238253                if ( ! assn.info.isUsed ) return true;
    239254
    240                 // lookup candidates for this assertion
    241                 std::list< SymTab::Indexer::IdData > candidates;
    242                 resn.indexer.lookupId( assn.decl->name, candidates );
    243 
    244                 // find the candidates that unify with the desired type
    245                 CandidateList matches;
    246                 for ( const auto& cdata : candidates ) {
    247                         DeclarationWithType* candidate = cdata.id;
    248 
    249                         // build independent unification context for candidate
    250                         AssertionSet have, newNeed;
    251                         TypeEnvironment newEnv{ resn.alt.env };
    252                         OpenVarSet newOpenVars{ resn.alt.openVars };
    253                         Type* adjType = candidate->get_type()->clone();
    254                         adjustExprType( adjType, newEnv, resn.indexer );
    255                         renameTyVars( adjType );
    256 
    257                         // keep unifying candidates
    258                         if ( unify( assn.decl->get_type(), adjType, newEnv, newNeed, have, newOpenVars,
    259                                         resn.indexer ) ) {
    260                                 // set up binding slot for recursive assertions
    261                                 UniqueId crntResnSlot = 0;
    262                                 if ( ! newNeed.empty() ) {
    263                                         crntResnSlot = ++globalResnSlot;
    264                                         for ( auto& a : newNeed ) {
    265                                                 a.second.resnSlot = crntResnSlot;
     255                // check cache for this assertion
     256                std::string assnKey = SymTab::Mangler::mangleAssnKey( assn.decl, resn.alt.env );
     257                auto it = cache.find( assnKey );
     258
     259                // attempt to resolve assertion if this is the first time seen
     260                if ( it == cache.end() ) {
     261                        // lookup candidates for this assertion
     262                        std::list< SymTab::Indexer::IdData > candidates;
     263                        resn.indexer.lookupId( assn.decl->name, candidates );
     264
     265                        // find the candidates that unify with the desired type
     266                        CandidateList matches;
     267                        for ( const auto& cdata : candidates ) {
     268                                DeclarationWithType* candidate = cdata.id;
     269
     270                                // build independent unification context for candidate
     271                                AssertionSet have, newNeed;
     272                                TypeEnvironment newEnv{ resn.alt.env };
     273                                OpenVarSet newOpenVars{ resn.alt.openVars };
     274                                Type* adjType = candidate->get_type()->clone();
     275                                adjustExprType( adjType, newEnv, resn.indexer );
     276                                renameTyVars( adjType );
     277
     278                                // keep unifying candidates
     279                                if ( unify( assn.decl->get_type(), adjType, newEnv, newNeed, have, newOpenVars,
     280                                                resn.indexer ) ) {
     281                                        // set up binding slot for recursive assertions
     282                                        UniqueId crntResnSlot = 0;
     283                                        if ( ! newNeed.empty() ) {
     284                                                crntResnSlot = ++globalResnSlot;
     285                                                for ( auto& a : newNeed ) {
     286                                                        a.second.resnSlot = crntResnSlot;
     287                                                }
    266288                                        }
    267                                 }
    268                                 // // set up idChain on new assertions
    269                                 // for ( auto& a : newNeed ) {
    270                                 //      a.second.idChain = assn.info.idChain;
    271                                 //      a.second.idChain.push_back( assn.decl->get_uniqueId() );
    272                                 // }
    273 
    274                                 matches.emplace_back( cdata, adjType, std::move(newEnv), std::move(have),
    275                                         std::move(newNeed), std::move(newOpenVars), crntResnSlot );
    276                         } else {
    277                                 delete adjType;
     289
     290                                        matches.emplace_back( cdata, adjType, std::move(newEnv), std::move(have),
     291                                                std::move(newNeed), std::move(newOpenVars), crntResnSlot );
     292                                } else {
     293                                        delete adjType;
     294                                }
    278295                        }
    279                 }
     296
     297                        it = cache.emplace_hint( it, assnKey, AssnCacheItem{ std::move(matches) } );
     298                }
     299
     300                CandidateList& matches = it->second.matches;
    280301
    281302                // break if no suitable assertion
     
    284305                // defer if too many suitable assertions
    285306                if ( matches.size() > 1 ) {
    286                         resn.deferred.emplace_back( assn.decl, assn.info, std::move(matches) );
     307                        it->second.deferIds.emplace_back( assn.decl, assn.info );
     308                        resn.deferred.emplace_back( cache, assnKey );
    287309                        return true;
    288310                }
     
    292314                addToIndexer( match.have, resn.indexer );
    293315                resn.newNeed.insert( match.need.begin(), match.need.end() );
    294                 resn.alt.env = std::move(match.env);
    295                 resn.alt.openVars = std::move(match.openVars);
     316                resn.alt.env = match.env;
     317                resn.alt.openVars = match.openVars;
    296318
    297319                bindAssertion( assn.decl, assn.info, resn.alt, match, resn.inferred );
     
    354376                ResnList resns{ ResnState{ alt, root_indexer } };
    355377                ResnList new_resns{};
     378                AssnCache assnCache;
    356379
    357380                // resolve assertions in breadth-first-order up to a limited number of levels deep
     
    362385                                for ( auto& assn : resn.need ) {
    363386                                        // fail early if any assertion is not resolvable
    364                                         if ( ! resolveAssertion( assn, resn ) ) goto nextResn;
     387                                        if ( ! resolveAssertion( assn, resn, assnCache ) ) goto nextResn;
    365388                                }
    366389
     
    373396                                        }
    374397                                } else {
     398                                        // only resolve each deferred assertion once
     399                                        std::sort( resn.deferred.begin(), resn.deferred.end() );
     400                                        auto last = std::unique( resn.deferred.begin(), resn.deferred.end() );
     401                                        resn.deferred.erase( last, resn.deferred.end() );
    375402                                        // resolve deferred assertions by mutual compatibility
    376403                                        std::vector<CandidateEnvMerger::OutType> compatible = filterCombos(
     
    380407                                        CandidateCost coster{ resn.indexer };
    381408                                        std::sort( compatible.begin(), compatible.end(), coster );
    382                                         // // sort by cost if pruning
    383                                         // if ( pruneAssertions ) {
    384                                         //      auto lmin = sort_mins( compatible.begin(), compatible.end(),
    385                                         //              CandidateCost{resn.indexer} );
    386                                         //      compatible.erase( lmin, compatible.end() );
    387                                         // }
    388409
    389410                                        // keep map of detected options
     
    408429                                                        new_resn.newNeed.insert( match.need.begin(), match.need.end() );
    409430
    410                                                         bindAssertion( r.decl, r.info, new_resn.alt, match, new_resn.inferred );
     431                                                        // for each deferred assertion with the same form
     432                                                        for ( AssnId id : r.item.deferIds ) {
     433                                                                bindAssertion(
     434                                                                        id.decl, id.info, new_resn.alt, match, new_resn.inferred );
     435                                                        }
    411436                                                }
    412437
  • src/ResolvExpr/Resolver.cc

    r9d9a451 r53bb8f1  
    99// Author           : Richard C. Bilson
    1010// Created On       : Sun May 17 12:17:01 2015
    11 // Last Modified By : Aaron B. Moss
    12 // Last Modified On : Fri Oct 05 09:43:00 2018
    13 // Update Count     : 214
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Tue Feb 19 18:09:56 2019
     13// Update Count     : 240
    1414//
    1515
     
    5353                }
    5454
    55                 void previsit( FunctionDecl *functionDecl );
    56                 void postvisit( FunctionDecl *functionDecl );
    57                 void previsit( ObjectDecl *objectDecll );
     55                void previsit( FunctionDecl * functionDecl );
     56                void postvisit( FunctionDecl * functionDecl );
     57                void previsit( ObjectDecl * objectDecll );
    5858                void previsit( EnumDecl * enumDecl );
    5959                void previsit( StaticAssertDecl * assertDecl );
     
    6262                void previsit( PointerType * at );
    6363
    64                 void previsit( ExprStmt *exprStmt );
    65                 void previsit( AsmExpr *asmExpr );
    66                 void previsit( AsmStmt *asmStmt );
    67                 void previsit( IfStmt *ifStmt );
    68                 void previsit( WhileStmt *whileStmt );
    69                 void previsit( ForStmt *forStmt );
    70                 void previsit( SwitchStmt *switchStmt );
    71                 void previsit( CaseStmt *caseStmt );
    72                 void previsit( BranchStmt *branchStmt );
    73                 void previsit( ReturnStmt *returnStmt );
    74                 void previsit( ThrowStmt *throwStmt );
    75                 void previsit( CatchStmt *catchStmt );
     64                void previsit( ExprStmt * exprStmt );
     65                void previsit( AsmExpr * asmExpr );
     66                void previsit( AsmStmt * asmStmt );
     67                void previsit( IfStmt * ifStmt );
     68                void previsit( WhileStmt * whileStmt );
     69                void previsit( ForStmt * forStmt );
     70                void previsit( SwitchStmt * switchStmt );
     71                void previsit( CaseStmt * caseStmt );
     72                void previsit( BranchStmt * branchStmt );
     73                void previsit( ReturnStmt * returnStmt );
     74                void previsit( ThrowStmt * throwStmt );
     75                void previsit( CatchStmt * catchStmt );
    7676                void previsit( WaitForStmt * stmt );
    7777
    78                 void previsit( SingleInit *singleInit );
    79                 void previsit( ListInit *listInit );
    80                 void previsit( ConstructorInit *ctorInit );
     78                void previsit( SingleInit * singleInit );
     79                void previsit( ListInit * listInit );
     80                void previsit( ConstructorInit * ctorInit );
    8181          private:
    8282                typedef std::list< Initializer * >::iterator InitIterator;
     
    104104        }
    105105
    106         void resolveDecl( Declaration * decl, const SymTab::Indexer &indexer ) {
     106        void resolveDecl( Declaration * decl, const SymTab::Indexer & indexer ) {
    107107                PassVisitor<Resolver> resolver( indexer );
    108108                maybeAccept( decl, resolver );
     
    148148                };
    149149
    150                 void finishExpr( Expression *&expr, const TypeEnvironment &env, TypeSubstitution * oldenv = nullptr ) {
     150                void finishExpr( Expression *& expr, const TypeEnvironment & env, TypeSubstitution * oldenv = nullptr ) {
    151151                        expr->env = oldenv ? oldenv->clone() : new TypeSubstitution;
    152152                        env.makeSubstitution( *expr->env );
     
    279279
    280280        // used in resolveTypeof
    281         Expression * resolveInVoidContext( Expression *expr, const SymTab::Indexer &indexer ) {
     281        Expression * resolveInVoidContext( Expression * expr, const SymTab::Indexer & indexer ) {
    282282                TypeEnvironment env;
    283283                return resolveInVoidContext( expr, indexer, env );
    284284        }
    285285
    286         Expression * resolveInVoidContext( Expression *expr, const SymTab::Indexer &indexer, TypeEnvironment &env ) {
     286        Expression * resolveInVoidContext( Expression * expr, const SymTab::Indexer & indexer, TypeEnvironment & env ) {
    287287                // it's a property of the language that a cast expression has either 1 or 0 interpretations; if it has 0
    288288                // interpretations, an exception has already been thrown.
    289289                assertf( expr, "expected a non-null expression." );
    290290
    291                 static CastExpr untyped( nullptr ); // cast to void
    292                 untyped.location = expr->location;
     291                CastExpr * untyped = new CastExpr( expr ); // cast to void
     292                untyped->location = expr->location;
    293293
    294294                // set up and resolve expression cast to void
    295                 untyped.arg = expr;
    296295                Alternative choice;
    297                 findUnfinishedKindExpression( &untyped, choice, indexer, "", standardAlternativeFilter, ResolvMode::withAdjustment() );
     296                findUnfinishedKindExpression( untyped, choice, indexer, "", standardAlternativeFilter, ResolvMode::withAdjustment() );
    298297                CastExpr * castExpr = strict_dynamic_cast< CastExpr * >( choice.expr );
     298                assert( castExpr );
    299299                env = std::move( choice.env );
    300300
     
    304304
    305305                // unlink the arg so that it isn't deleted twice at the end of the program
    306                 untyped.arg = nullptr;
     306                untyped->arg = nullptr;
    307307                return ret;
    308308        }
    309309
    310         void findVoidExpression( Expression *& untyped, const SymTab::Indexer &indexer ) {
     310        void findVoidExpression( Expression *& untyped, const SymTab::Indexer & indexer ) {
    311311                resetTyVarRenaming();
    312312                TypeEnvironment env;
     
    317317        }
    318318
    319         void findSingleExpression( Expression *&untyped, const SymTab::Indexer &indexer ) {
     319        void findSingleExpression( Expression *& untyped, const SymTab::Indexer & indexer ) {
    320320                findKindExpression( untyped, indexer, "", standardAlternativeFilter );
    321321        }
     
    336336                        if ( dynamic_cast< EnumInstType * >( type ) ) {
    337337                                return true;
    338                         } else if ( BasicType *bt = dynamic_cast< BasicType * >( type ) ) {
     338                        } else if ( BasicType * bt = dynamic_cast< BasicType * >( type ) ) {
    339339                                return bt->isInteger();
    340340                        } else if ( dynamic_cast< ZeroType* >( type ) != nullptr || dynamic_cast< OneType* >( type ) != nullptr ) {
     
    345345                }
    346346
    347                 void findIntegralExpression( Expression *& untyped, const SymTab::Indexer &indexer ) {
     347                void findIntegralExpression( Expression *& untyped, const SymTab::Indexer & indexer ) {
    348348                        findKindExpression( untyped, indexer, "condition", isIntegralType );
    349349                }
     
    401401        }
    402402
    403         void Resolver::previsit( ObjectDecl *objectDecl ) {
     403        void Resolver::previsit( ObjectDecl * objectDecl ) {
    404404                // To handle initialization of routine pointers, e.g., int (*fp)(int) = foo(), means that
    405405                // class-variable initContext is changed multiple time because the LHS is analysed twice.
     
    431431        }
    432432
    433         void Resolver::previsit( FunctionDecl *functionDecl ) {
     433        void Resolver::previsit( FunctionDecl * functionDecl ) {
    434434#if 0
    435435                std::cerr << "resolver visiting functiondecl ";
     
    441441        }
    442442
    443         void Resolver::postvisit( FunctionDecl *functionDecl ) {
     443        void Resolver::postvisit( FunctionDecl * functionDecl ) {
    444444                // default value expressions have an environment which shouldn't be there and trips up
    445445                // later passes.
     
    466466        }
    467467
    468         void Resolver::previsit( ExprStmt *exprStmt ) {
     468        void Resolver::previsit( ExprStmt * exprStmt ) {
    469469                visit_children = false;
    470470                assertf( exprStmt->expr, "ExprStmt has null Expression in resolver" );
     
    472472        }
    473473
    474         void Resolver::previsit( AsmExpr *asmExpr ) {
     474        void Resolver::previsit( AsmExpr * asmExpr ) {
    475475                visit_children = false;
    476476                findVoidExpression( asmExpr->operand, indexer );
     
    480480        }
    481481
    482         void Resolver::previsit( AsmStmt *asmStmt ) {
     482        void Resolver::previsit( AsmStmt * asmStmt ) {
    483483                visit_children = false;
    484484                acceptAll( asmStmt->get_input(), *visitor );
     
    486486        }
    487487
    488         void Resolver::previsit( IfStmt *ifStmt ) {
     488        void Resolver::previsit( IfStmt * ifStmt ) {
    489489                findIntegralExpression( ifStmt->condition, indexer );
    490490        }
    491491
    492         void Resolver::previsit( WhileStmt *whileStmt ) {
     492        void Resolver::previsit( WhileStmt * whileStmt ) {
    493493                findIntegralExpression( whileStmt->condition, indexer );
    494494        }
    495495
    496         void Resolver::previsit( ForStmt *forStmt ) {
     496        void Resolver::previsit( ForStmt * forStmt ) {
    497497                if ( forStmt->condition ) {
    498498                        findIntegralExpression( forStmt->condition, indexer );
     
    504504        }
    505505
    506         void Resolver::previsit( SwitchStmt *switchStmt ) {
     506        void Resolver::previsit( SwitchStmt * switchStmt ) {
    507507                GuardValue( currentObject );
    508508                findIntegralExpression( switchStmt->condition, indexer );
     
    511511        }
    512512
    513         void Resolver::previsit( CaseStmt *caseStmt ) {
     513        void Resolver::previsit( CaseStmt * caseStmt ) {
    514514                if ( caseStmt->condition ) {
    515515                        std::list< InitAlternative > initAlts = currentObject.getOptions();
     
    530530        }
    531531
    532         void Resolver::previsit( BranchStmt *branchStmt ) {
     532        void Resolver::previsit( BranchStmt * branchStmt ) {
    533533                visit_children = false;
    534534                // must resolve the argument for a computed goto
     
    541541        }
    542542
    543         void Resolver::previsit( ReturnStmt *returnStmt ) {
     543        void Resolver::previsit( ReturnStmt * returnStmt ) {
    544544                visit_children = false;
    545545                if ( returnStmt->expr ) {
     
    548548        }
    549549
    550         void Resolver::previsit( ThrowStmt *throwStmt ) {
     550        void Resolver::previsit( ThrowStmt * throwStmt ) {
    551551                visit_children = false;
    552552                // TODO: Replace *exception type with &exception type.
     
    560560        }
    561561
    562         void Resolver::previsit( CatchStmt *catchStmt ) {
     562        void Resolver::previsit( CatchStmt * catchStmt ) {
    563563                if ( catchStmt->cond ) {
    564564                        findSingleExpression( catchStmt->cond, new BasicType( noQualifiers, BasicType::Bool ), indexer );
     
    724724
    725725                                                }
    726                                                 catch( SemanticErrorException &e ) {
     726                                                catch( SemanticErrorException & e ) {
    727727                                                        errors.append( e );
    728728                                                }
    729729                                        }
    730730                                }
    731                                 catch( SemanticErrorException &e ) {
     731                                catch( SemanticErrorException & e ) {
    732732                                        errors.append( e );
    733733                                }
     
    781781        }
    782782
    783         void Resolver::previsit( SingleInit *singleInit ) {
     783        void Resolver::previsit( SingleInit * singleInit ) {
    784784                visit_children = false;
    785785                // resolve initialization using the possibilities as determined by the currentObject cursor
     
    813813                                if ( PointerType * pt = dynamic_cast< PointerType *>( newExpr->get_result() ) ) {
    814814                                        if ( isCharType( pt->get_base() ) ) {
    815                                                 if ( CastExpr *ce = dynamic_cast< CastExpr * >( newExpr ) ) {
     815                                                if ( CastExpr * ce = dynamic_cast< CastExpr * >( newExpr ) ) {
    816816                                                        // strip cast if we're initializing a char[] with a char *,
    817817                                                        // e.g.  char x[] = "hello";
     
    893893        }
    894894
    895         void Resolver::previsit( ConstructorInit *ctorInit ) {
     895        void Resolver::previsit( ConstructorInit * ctorInit ) {
    896896                visit_children = false;
    897897                // xxx - fallback init has been removed => remove fallbackInit function and remove complexity from FixInit and remove C-init from ConstructorInit
  • src/ResolvExpr/Resolver.h

    r9d9a451 r53bb8f1  
    1010// Created On       : Sun May 17 12:18:34 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Jul 22 09:36:57 2017
    13 // Update Count     : 3
     12// Last Modified On : Mon Feb 18 20:40:38 2019
     13// Update Count     : 4
    1414//
    1515
     
    2929        /// Checks types and binds syntactic constructs to typed representations
    3030        void resolve( std::list< Declaration * > translationUnit );
    31         void resolveDecl( Declaration *, const SymTab::Indexer &indexer );
    32         Expression *resolveInVoidContext( Expression * expr, const SymTab::Indexer &indexer );
    33         void findVoidExpression( Expression *& untyped, const SymTab::Indexer &indexer );
    34         void findSingleExpression( Expression *& untyped, const SymTab::Indexer &indexer );
    35         void findSingleExpression( Expression *& untyped, Type * type, const SymTab::Indexer &indexer );
     31        void resolveDecl( Declaration *, const SymTab::Indexer & indexer );
     32        Expression *resolveInVoidContext( Expression * expr, const SymTab::Indexer & indexer );
     33        void findVoidExpression( Expression *& untyped, const SymTab::Indexer & indexer );
     34        void findSingleExpression( Expression *& untyped, const SymTab::Indexer & indexer );
     35        void findSingleExpression( Expression *& untyped, Type * type, const SymTab::Indexer & indexer );
    3636        void resolveCtorInit( ConstructorInit * ctorInit, const SymTab::Indexer & indexer );
    3737        void resolveStmtExpr( StmtExpr * stmtExpr, const SymTab::Indexer & indexer );
  • src/ResolvExpr/module.mk

    r9d9a451 r53bb8f1  
    1515###############################################################################
    1616
    17 SRC += ResolvExpr/AlternativeFinder.cc \
    18        ResolvExpr/Alternative.cc \
    19        ResolvExpr/Unify.cc \
    20        ResolvExpr/PtrsAssignable.cc \
    21        ResolvExpr/CommonType.cc \
    22        ResolvExpr/ConversionCost.cc \
    23        ResolvExpr/CastCost.cc \
    24        ResolvExpr/PtrsCastable.cc \
    25        ResolvExpr/AdjustExprType.cc \
    26        ResolvExpr/AlternativePrinter.cc \
    27        ResolvExpr/Resolver.cc \
    28        ResolvExpr/ResolveTypeof.cc \
    29        ResolvExpr/RenameVars.cc \
    30        ResolvExpr/FindOpenVars.cc \
    31        ResolvExpr/PolyCost.cc \
    32        ResolvExpr/Occurs.cc \
    33        ResolvExpr/TypeEnvironment.cc \
    34        ResolvExpr/CurrentObject.cc \
    35        ResolvExpr/ExplodedActual.cc \
    36        ResolvExpr/SpecCost.cc \
    37        ResolvExpr/ResolveAssertions.cc
     17SRC_RESOLVEXPR = \
     18      ResolvExpr/AdjustExprType.cc \
     19      ResolvExpr/Alternative.cc \
     20      ResolvExpr/AlternativeFinder.cc \
     21      ResolvExpr/CastCost.cc \
     22      ResolvExpr/CommonType.cc \
     23      ResolvExpr/ConversionCost.cc \
     24      ResolvExpr/CurrentObject.cc \
     25      ResolvExpr/ExplodedActual.cc \
     26      ResolvExpr/FindOpenVars.cc \
     27      ResolvExpr/Occurs.cc \
     28      ResolvExpr/PolyCost.cc \
     29      ResolvExpr/PtrsAssignable.cc \
     30      ResolvExpr/PtrsCastable.cc \
     31      ResolvExpr/RenameVars.cc \
     32      ResolvExpr/ResolveAssertions.cc \
     33      ResolvExpr/Resolver.cc \
     34      ResolvExpr/ResolveTypeof.cc \
     35      ResolvExpr/SpecCost.cc \
     36      ResolvExpr/TypeEnvironment.cc \
     37      ResolvExpr/Unify.cc
     38
     39SRC += $(SRC_RESOLVEXPR) ResolvExpr/AlternativePrinter.cc
     40SRCDEMANGLE += $(SRC_RESOLVEXPR)
  • src/ResolvExpr/typeops.h

    r9d9a451 r53bb8f1  
    1010// Created On       : Sun May 17 07:28:22 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Jul 22 09:36:18 2017
    13 // Update Count     : 3
     12// Last Modified On : Fri Feb  8 09:30:34 2019
     13// Update Count     : 4
    1414//
    1515
     
    101101
    102102        // in CommonType.cc
    103         Type *commonType( Type *type1, Type *type2, bool widenFirst, bool widenSecond, const SymTab::Indexer &indexer, TypeEnvironment &env, const OpenVarSet &openVars );
     103        Type * commonType( Type *type1, Type *type2, bool widenFirst, bool widenSecond, const SymTab::Indexer &indexer, TypeEnvironment &env, const OpenVarSet &openVars );
    104104
    105105        // in PolyCost.cc
  • src/SymTab/Indexer.cc

    r9d9a451 r53bb8f1  
    2626#include "Common/SemanticError.h"  // for SemanticError
    2727#include "Common/utility.h"        // for cloneAll
     28#include "Common/Stats/Counter.h" // for counters
    2829#include "GenPoly/GenPoly.h"
    2930#include "InitTweak/InitTweak.h"   // for isConstructor, isCopyFunction, isC...
     
    4142
    4243namespace SymTab {
     44
     45        // Statistics block
     46        namespace {
     47
     48                static inline auto stats_idtable() {
     49                        using namespace Stats::Counters;
     50                        static auto group = build<CounterGroup>("IdTable");
     51                        static struct {
     52                                SimpleCounter * find;
     53                                AverageCounter<double> * size;
     54                                AverageCounter<double> * key;
     55                        } ret = {
     56                                .find = build<SimpleCounter>("Find calls", group),
     57                                .size = build<AverageCounter<double>>("Average Size", group),
     58                                .key  = build<AverageCounter<double>>("Average Key Size", group),
     59                        };
     60                        return ret;
     61                }
     62
     63                static inline auto stats_indexers() {
     64                        using namespace Stats::Counters;
     65                        static auto group   = build<CounterGroup>("Indexers");
     66                        static struct {
     67                                SimpleCounter * count;
     68                                AverageCounter<double> * size;
     69                                AverageCounter<double> * depth_a;
     70                                MaxCounter<size_t> * depth_m;
     71                        } ret = {
     72                                .count   = build<SimpleCounter>("Count", group),
     73                                .size    = build<AverageCounter<double>>("Average Size", group),
     74                                .depth_a = build<AverageCounter<double>>("Average Depth", group),
     75                                .depth_m = build<MaxCounter<size_t>>("Max Depth", group),
     76                        };
     77                        return ret;
     78                }
     79        }
     80
    4381        std::ostream & operator<<( std::ostream & out, const Indexer::IdData & data ) {
    4482                return out << "(" << data.id << "," << data.baseExpr << ")";
     
    197235        }
    198236
    199         Indexer::Indexer() : tables( 0 ), scope( 0 ) {}
    200 
    201         Indexer::Indexer( const Indexer &that ) : doDebug( that.doDebug ), tables( newRef( that.tables ) ), scope( that.scope ) {}
     237        Indexer::Indexer() : tables( 0 ), scope( 0 ) {
     238                (*stats_indexers().count)++;
     239        }
     240
     241        Indexer::Indexer( const Indexer &that ) : doDebug( that.doDebug ), tables( newRef( that.tables ) ), scope( that.scope ) {
     242                (*stats_indexers().count)++;
     243        }
    202244
    203245        Indexer::Indexer( Indexer &&that ) : doDebug( that.doDebug ), tables( that.tables ), scope( that.scope ) {
     
    206248
    207249        Indexer::~Indexer() {
     250                if(tables) {
     251                        stats_indexers().size->push( tables->idTable.size() );
     252                        size_t depth = 1;
     253                        for( auto crnt = tables->base.tables; crnt; crnt = crnt->base.tables ) {
     254                                ++depth;
     255                        }
     256                        stats_indexers().depth_a->push( depth );
     257                        stats_indexers().depth_m->push( depth );
     258                }
    208259                deleteRef( tables );
    209260        }
     
    237288                while ( searchTables ) {
    238289
     290                        (*stats_idtable().find)++;
     291                        stats_idtable().key->push( id.size() );
     292                        stats_idtable().size->push( searchTables->idTable.size() );
    239293                        IdTable::const_iterator decls = searchTables->idTable.find( id );
    240294                        if ( decls != searchTables->idTable.end() ) {
     
    313367                if ( tables->scope < scope ) return nullptr;
    314368
     369                (*stats_idtable().find)++;
     370                stats_idtable().key->push( id.size() );
     371                stats_idtable().size->push( tables->idTable.size() );
    315372                IdTable::const_iterator decls = tables->idTable.find( id );
    316373                if ( decls != tables->idTable.end() ) {
     
    331388                if ( tables->scope < scope ) return false;
    332389
     390                (*stats_idtable().find)++;
     391                stats_idtable().key->push( id.size() );
     392                stats_idtable().size->push( tables->idTable.size() );
    333393                IdTable::const_iterator decls = tables->idTable.find( id );
    334394                if ( decls != tables->idTable.end() ) {
     
    347407                if ( tables->scope < scope ) return false;
    348408
     409                (*stats_idtable().find)++;
     410                stats_idtable().key->push( id.size() );
     411                stats_idtable().size->push( tables->idTable.size() );
    349412                IdTable::const_iterator decls = tables->idTable.find( id );
    350413                if ( decls != tables->idTable.end() ) {
  • src/SymTab/Mangler.cc

    r9d9a451 r53bb8f1  
    1515#include "Mangler.h"
    1616
    17 #include <algorithm>                // for copy, transform
    18 #include <cassert>                  // for assert, assertf
    19 #include <functional>               // for const_mem_fun_t, mem_fun
    20 #include <iterator>                 // for ostream_iterator, back_insert_ite...
    21 #include <list>                     // for _List_iterator, list, _List_const...
    22 #include <string>                   // for string, char_traits, operator<<
    23 
    24 #include "CodeGen/OperatorTable.h"  // for OperatorInfo, operatorLookup
     17#include <algorithm>                     // for copy, transform
     18#include <cassert>                       // for assert, assertf
     19#include <functional>                    // for const_mem_fun_t, mem_fun
     20#include <iterator>                      // for ostream_iterator, back_insert_ite...
     21#include <list>                          // for _List_iterator, list, _List_const...
     22#include <string>                        // for string, char_traits, operator<<
     23
     24#include "CodeGen/OperatorTable.h"       // for OperatorInfo, operatorLookup
    2525#include "Common/PassVisitor.h"
    26 #include "Common/SemanticError.h"   // for SemanticError
    27 #include "Common/utility.h"         // for toString
    28 #include "Parser/LinkageSpec.h"     // for Spec, isOverridable, AutoGen, Int...
    29 #include "SynTree/Declaration.h"    // for TypeDecl, DeclarationWithType
    30 #include "SynTree/Expression.h"     // for TypeExpr, Expression, operator<<
    31 #include "SynTree/Type.h"           // for Type, ReferenceToType, Type::Fora...
     26#include "Common/SemanticError.h"        // for SemanticError
     27#include "Common/utility.h"              // for toString
     28#include "Parser/LinkageSpec.h"          // for Spec, isOverridable, AutoGen, Int...
     29#include "ResolvExpr/TypeEnvironment.h"  // for TypeEnvironment
     30#include "SynTree/Declaration.h"         // for TypeDecl, DeclarationWithType
     31#include "SynTree/Expression.h"          // for TypeExpr, Expression, operator<<
     32#include "SynTree/Type.h"                // for Type, ReferenceToType, Type::Fora...
    3233
    3334namespace SymTab {
     
    3738                        struct Mangler : public WithShortCircuiting, public WithVisitorRef<Mangler>, public WithGuards {
    3839                                Mangler( bool mangleOverridable, bool typeMode, bool mangleGenericParams );
     40                                Mangler( const ResolvExpr::TypeEnvironment& env );
    3941                                Mangler( const Mangler & ) = delete;
    4042
     
    6567                          private:
    6668                                std::ostringstream mangleName;  ///< Mangled name being constructed
    67                                 typedef std::map< std::string, std::pair< int, int > > VarMapType;
     69                                typedef std::map< std::string, std::pair< std::string, int > > VarMapType;
    6870                                VarMapType varNums;             ///< Map of type variables to indices
    6971                                int nextVarNum;                 ///< Next type variable index
     72                                const ResolvExpr::TypeEnvironment* env;  ///< optional environment for substitutions
    7073                                bool isTopLevel;                ///< Is the Mangler at the top level
    7174                                bool mangleOverridable;         ///< Specially mangle overridable built-in methods
     
    7578                                bool inQualifiedType = false;   ///< Add start/end delimiters around qualified type
    7679
     80                          public:
     81                                Mangler( bool mangleOverridable, bool typeMode, bool mangleGenericParams,
     82                                        int nextVarNum, const ResolvExpr::TypeEnvironment* env,
     83                                        const VarMapType& varNums );
     84
     85                          private:
    7786                                void mangleDecl( DeclarationWithType *declaration );
    7887                                void mangleRef( ReferenceToType *refType, std::string prefix );
     
    100109                }
    101110
     111                std::string mangleAssnKey( DeclarationWithType* decl,
     112                                const ResolvExpr::TypeEnvironment& env ) {
     113                        PassVisitor<Mangler> mangler( env );
     114                        maybeAccept( decl, mangler );
     115                        return mangler.pass.get_mangleName();
     116                }
     117
    102118                namespace {
    103119                        Mangler::Mangler( bool mangleOverridable, bool typeMode, bool mangleGenericParams )
    104                                 : nextVarNum( 0 ), isTopLevel( true ), mangleOverridable( mangleOverridable ), typeMode( typeMode ), mangleGenericParams( mangleGenericParams ) {}
     120                                : nextVarNum( 0 ), env(nullptr), isTopLevel( true ),
     121                                mangleOverridable( mangleOverridable ), typeMode( typeMode ),
     122                                mangleGenericParams( mangleGenericParams ) {}
     123                       
     124                        Mangler::Mangler( const ResolvExpr::TypeEnvironment& env )
     125                                : nextVarNum( 0 ), env( &env ), isTopLevel( true ), mangleOverridable( false ),
     126                                typeMode( false ), mangleGenericParams( true ) {}
     127                       
     128                        Mangler::Mangler( bool mangleOverridable, bool typeMode, bool mangleGenericParams,
     129                                int nextVarNum, const ResolvExpr::TypeEnvironment* env,
     130                                const VarMapType& varNums )
     131                                : varNums( varNums ), nextVarNum( nextVarNum ), env( env ), isTopLevel( false ),
     132                                mangleOverridable( mangleOverridable ), typeMode( typeMode ),
     133                                mangleGenericParams( mangleGenericParams ) {}
    105134
    106135                        void Mangler::mangleDecl( DeclarationWithType * declaration ) {
     
    329358                                                        assert( false );
    330359                                                } // switch
    331                                                 varNums[ (*i)->name ] = std::pair< int, int >( nextVarNum++, (int)(*i)->get_kind() );
     360                                                std::string varName;
     361                                                // replace type with substitution name if environment is available and bound
     362                                                if ( env ) {
     363                                                        const ResolvExpr::EqvClass* varClass = env->lookup( (*i)->name );
     364                                                        if ( varClass && varClass->type ) {
     365                                                                PassVisitor<Mangler> sub_mangler(
     366                                                                        mangleOverridable, typeMode, mangleGenericParams, nextVarNum,
     367                                                                        env, varNums );
     368                                                                varClass->type->accept( sub_mangler );
     369                                                                varName = std::string{"%"} + sub_mangler.pass.get_mangleName();
     370                                                        }
     371                                                }
     372                                                // otherwise just give type numeric name
     373                                                if ( varName.empty() ) {
     374                                                        varName = std::to_string( nextVarNum++ );
     375                                                }
     376                                                varNums[ (*i)->name ] = std::make_pair( varName, (int)(*i)->get_kind() );
    332377                                                for ( std::list< DeclarationWithType* >::iterator assert = (*i)->assertions.begin(); assert != (*i)->assertions.end(); ++assert ) {
    333                                                         PassVisitor<Mangler> sub_mangler( mangleOverridable, typeMode, mangleGenericParams );
    334                                                         sub_mangler.pass.nextVarNum = nextVarNum;
    335                                                         sub_mangler.pass.isTopLevel = false;
    336                                                         sub_mangler.pass.varNums = varNums;
     378                                                        PassVisitor<Mangler> sub_mangler(
     379                                                                mangleOverridable, typeMode, mangleGenericParams, nextVarNum, env,
     380                                                                varNums );
    337381                                                        (*assert)->accept( sub_mangler );
    338                                                         assertionNames.push_back( sub_mangler.pass.mangleName.str() );
     382                                                        assertionNames.push_back( sub_mangler.pass.get_mangleName() );
    339383                                                        acount++;
    340384                                                } // for
  • src/SymTab/Mangler.h

    r9d9a451 r53bb8f1  
    3131// * Currently name compression is not implemented.
    3232
     33namespace ResolvExpr {
     34        class TypeEnvironment;
     35}
     36
    3337namespace SymTab {
    3438        namespace Mangler {
     
    4044                /// Mangle ignoring generic type parameters
    4145                std::string mangleConcrete( Type* ty );
     46                /// Mangle for assertion key
     47                std::string mangleAssnKey( DeclarationWithType* decl,
     48                        const ResolvExpr::TypeEnvironment& env );
    4249
    4350                namespace Encoding {
  • src/SymTab/ManglerCommon.cc

    r9d9a451 r53bb8f1  
    1010// Created On       : Sun May 17 21:44:03 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Jul 22 09:45:30 2017
    13 // Update Count     : 15
     12// Last Modified On : Thu Feb 14 17:06:37 2019
     13// Update Count     : 26
    1414//
    1515
     
    2323                        const std::string manglePrefix = "_X";
    2424
    25                         const std::string basicTypes[] = {
    26                                 "b",  // Bool
    27                                 "c",  // Char
    28                                 "a",  // SignedChar
    29                                 "h",  // UnsignedChar
    30                                 "s",  // ShortSignedInt
    31                                 "t",  // ShortUnsignedInt
    32                                 "i",  // SignedInt
    33                                 "j",  // UnsignedInt
    34                                 "l",  // LongSignedInt
    35                                 "m",  // LongUnsignedInt
    36                                 "x",  // LongLongSignedInt
    37                                 "y",  // LongLongUnsignedInt
    38                                 "f",  // Float
    39                                 "d",  // Double
    40                                 "e",  // LongDouble
    41                                 "Cf", // FloatComplex
    42                                 "Cd", // DoubleComplex
    43                                 "Ce", // LongDoubleComplex
    44                                 // Note: imaginary is not an overloadable type in C++
    45                                 "If", // FloatImaginary
    46                                 "Id", // DoubleImaginary
    47                                 "Ie", // LongDoubleImaginary
    48                                 "n",  // SignedInt128
    49                                 "o",  // UnsignedInt128
    50                                 "Dq",  // Float80 -- TODO: itanium says Float80 and LongDouble both encode to "e", but doing this causes problems with constructing long double, because the cost tables are incorrect
    51                                 "g",  // Float128
    52                                 // "z", // ellipsis
    53                                 // "Dd" // # IEEE 754r decimal floating point (64 bits)
    54                                 // "De" // # IEEE 754r decimal floating point (128 bits)
    55                                 // "Df" // # IEEE 754r decimal floating point (32 bits)
    56                                 // "Dh" // # IEEE 754r half-precision floating point (16 bits)
    57                                 // "DF"N_ // # ISO/IEC TS 18661 binary floating point type _FloatN (N bits)
    58                                 // "Di" // char32_t
    59                                 // "Ds" // char16_t
    60                         };
     25                        // GENERATED START, DO NOT EDIT
     26                        // GENERATED BY BasicTypes-gen.cc
     27                        // NOTES ON MANGLING:
     28                        // * Itanium spec says that Float80 encodes to "e" (like LongDouble), but the distinct lengths cause resolution problems.
     29                        // * Float128 is supposed to encode to "g", but I wanted it to mangle equal to LongDouble.
     30                        // * Mangling for non-standard complex types is by best guess
     31                        // * _FloatN is supposed to encode as "DF"N"_"; modified for same reason as above.
     32                        // * unused mangling identifiers:
     33                        //   - "z" ellipsis
     34                        //   - "Dd" IEEE 754r 64-bit decimal floating point (borrowed for _Float32x)
     35                        //   - "De" IEEE 754r 128-bit decimal floating point
     36                        //   - "Df" IEEE 754r 32-bit decimal floating point
     37                        //   - "Dh" IEEE 754r 16-bit decimal floating point (borrowed for _Float16)
     38                        //   - "DF"N"_" ISO/IEC TS 18661 N-bit binary floating point (_FloatN)
     39                        //   - "Di" char32_t
     40                        //   - "Ds" char16_t
     41                        const std::string basicTypes[BasicType::NUMBER_OF_BASIC_TYPES] = {
     42                                "b",        // _Bool
     43                                "c",        // char
     44                                "a",        // signed char
     45                                "h",        // unsigned char
     46                                "s",        // signed short int
     47                                "t",        // unsigned short int
     48                                "i",        // signed int
     49                                "j",        // unsigned int
     50                                "l",        // signed long int
     51                                "m",        // unsigned long int
     52                                "x",        // signed long long int
     53                                "y",        // unsigned long long int
     54                                "n",        // __int128
     55                                "o",        // unsigned __int128
     56                                "DF16_",    // _Float16
     57                                "CDF16_",   // _Float16 _Complex
     58                                "DF32_",    // _Float32
     59                                "CDF32_",   // _Float32 _Complex
     60                                "f",        // float
     61                                "Cf",       // float _Complex
     62                                "DF32x_",   // _Float32x
     63                                "CDF32x_",  // _Float32x _Complex
     64                                "DF64_",    // _Float64
     65                                "CDF64_",   // _Float64 _Complex
     66                                "d",        // double
     67                                "Cd",       // double _Complex
     68                                "DF64x_",   // _Float64x
     69                                "CDF64x_",  // _Float64x _Complex
     70                                "Dq",       // __float80
     71                                "DF128_",   // _Float128
     72                                "CDF128_",  // _Float128 _Complex
     73                                "g",        // __float128
     74                                "e",        // long double
     75                                "Ce",       // long double _Complex
     76                                "DF128x_",  // _Float128x
     77                                "CDF128x_", // _Float128x _Complex
     78                        }; // basicTypes
     79                        // GENERATED END
    6180                        static_assert(
    6281                                sizeof(basicTypes)/sizeof(basicTypes[0]) == BasicType::NUMBER_OF_BASIC_TYPES,
  • src/SymTab/Validate.cc

    r9d9a451 r53bb8f1  
    4949#include "CodeGen/OperatorTable.h"     // for isCtorDtor, isCtorDtorAssign
    5050#include "ControlStruct/Mutate.h"      // for ForExprMutator
     51#include "Common/Stats.h"              // for Stats::Heap
    5152#include "Common/PassVisitor.h"        // for PassVisitor, WithDeclsToAdd
    5253#include "Common/ScopedMap.h"          // for ScopedMap
     
    303304                PassVisitor<FixQualifiedTypes> fixQual;
    304305
    305                 acceptAll( translationUnit, hoistDecls );
    306                 ReplaceTypedef::replaceTypedef( translationUnit );
    307                 ReturnTypeFixer::fix( translationUnit ); // must happen before autogen
    308                 acceptAll( translationUnit, epc ); // must happen before VerifyCtorDtorAssign, because void return objects should not exist; before LinkReferenceToTypes because it is an indexer and needs correct types for mangling
    309                 acceptAll( translationUnit, lrt ); // must happen before autogen, because sized flag needs to propagate to generated functions
    310                 mutateAll( translationUnit, fixQual ); // must happen after LinkReferenceToTypes, because aggregate members are accessed
    311                 HoistStruct::hoistStruct( translationUnit ); // must happen after EliminateTypedef, so that aggregate typedefs occur in the correct order
    312                 EliminateTypedef::eliminateTypedef( translationUnit ); //
    313                 acceptAll( translationUnit, genericParams );  // check as early as possible - can't happen before LinkReferenceToTypes
    314                 VerifyCtorDtorAssign::verify( translationUnit );  // must happen before autogen, because autogen examines existing ctor/dtors
    315                 ReturnChecker::checkFunctionReturns( translationUnit );
    316                 InitTweak::fixReturnStatements( translationUnit ); // must happen before autogen
    317                 Concurrency::applyKeywords( translationUnit );
    318                 acceptAll( translationUnit, fpd ); // must happen before autogenerateRoutines, after Concurrency::applyKeywords because uniqueIds must be set on declaration before resolution
    319                 ControlStruct::hoistControlDecls( translationUnit );  // hoist initialization out of for statements; must happen before autogenerateRoutines
    320                 autogenerateRoutines( translationUnit ); // moved up, used to be below compoundLiteral - currently needs EnumAndPointerDecay
    321                 Concurrency::implementMutexFuncs( translationUnit );
    322                 Concurrency::implementThreadStarter( translationUnit );
    323                 mutateAll( translationUnit, compoundliteral );
    324                 ResolvExpr::resolveWithExprs( translationUnit ); // must happen before FixObjectType because user-code is resolved and may contain with variables
    325                 FixObjectType::fix( translationUnit );
    326                 ArrayLength::computeLength( translationUnit );
    327                 acceptAll( translationUnit, finder ); // xxx - remove this pass soon
    328                 mutateAll( translationUnit, labelAddrFixer );
    329                 Validate::handleAttributes( translationUnit );
     306                {
     307                        Stats::Heap::newPass("validate-A");
     308                        Stats::Time::BlockGuard guard("validate-A");
     309                        acceptAll( translationUnit, hoistDecls );
     310                        ReplaceTypedef::replaceTypedef( translationUnit );
     311                        ReturnTypeFixer::fix( translationUnit ); // must happen before autogen
     312                        acceptAll( translationUnit, epc ); // must happen before VerifyCtorDtorAssign, because void return objects should not exist; before LinkReferenceToTypes because it is an indexer and needs correct types for mangling
     313                }
     314                {
     315                        Stats::Heap::newPass("validate-B");
     316                        Stats::Time::BlockGuard guard("validate-B");
     317                        Stats::Time::TimeBlock("Link Reference To Types", [&]() {
     318                                acceptAll( translationUnit, lrt ); // must happen before autogen, because sized flag needs to propagate to generated functions
     319                        });
     320                        Stats::Time::TimeBlock("Fix Qualified Types", [&]() {
     321                                mutateAll( translationUnit, fixQual ); // must happen after LinkReferenceToTypes, because aggregate members are accessed
     322                        });
     323                        Stats::Time::TimeBlock("Hoist Structs", [&]() {
     324                                HoistStruct::hoistStruct( translationUnit ); // must happen after EliminateTypedef, so that aggregate typedefs occur in the correct order
     325                        });
     326                        Stats::Time::TimeBlock("Eliminate Typedefs", [&]() {
     327                                EliminateTypedef::eliminateTypedef( translationUnit ); //
     328                        });
     329                }
     330                {
     331                        Stats::Heap::newPass("validate-C");
     332                        Stats::Time::BlockGuard guard("validate-C");
     333                        acceptAll( translationUnit, genericParams );  // check as early as possible - can't happen before LinkReferenceToTypes
     334                        VerifyCtorDtorAssign::verify( translationUnit );  // must happen before autogen, because autogen examines existing ctor/dtors
     335                        ReturnChecker::checkFunctionReturns( translationUnit );
     336                        InitTweak::fixReturnStatements( translationUnit ); // must happen before autogen
     337                }
     338                {
     339                        Stats::Heap::newPass("validate-D");
     340                        Stats::Time::BlockGuard guard("validate-D");
     341                        Stats::Time::TimeBlock("Apply Concurrent Keywords", [&]() {
     342                                Concurrency::applyKeywords( translationUnit );
     343                        });
     344                        Stats::Time::TimeBlock("Forall Pointer Decay", [&]() {
     345                                acceptAll( translationUnit, fpd ); // must happen before autogenerateRoutines, after Concurrency::applyKeywords because uniqueIds must be set on declaration before resolution
     346                        });
     347                        Stats::Time::TimeBlock("Hoist Control Declarations", [&]() {
     348                                ControlStruct::hoistControlDecls( translationUnit );  // hoist initialization out of for statements; must happen before autogenerateRoutines
     349                        });
     350                        Stats::Time::TimeBlock("Generate Autogen routines", [&]() {
     351                                autogenerateRoutines( translationUnit ); // moved up, used to be below compoundLiteral - currently needs EnumAndPointerDecay
     352                        });
     353                }
     354                {
     355                        Stats::Heap::newPass("validate-E");
     356                        Stats::Time::BlockGuard guard("validate-E");
     357                        Stats::Time::TimeBlock("Implement Mutex Func", [&]() {
     358                                Concurrency::implementMutexFuncs( translationUnit );
     359                        });
     360                        Stats::Time::TimeBlock("Implement Thread Start", [&]() {
     361                                Concurrency::implementThreadStarter( translationUnit );
     362                        });
     363                        Stats::Time::TimeBlock("Compound Literal", [&]() {
     364                                mutateAll( translationUnit, compoundliteral );
     365                        });
     366                        Stats::Time::TimeBlock("Resolve With Expressions", [&]() {
     367                                ResolvExpr::resolveWithExprs( translationUnit ); // must happen before FixObjectType because user-code is resolved and may contain with variables
     368                        });
     369                }
     370                {
     371                        Stats::Heap::newPass("validate-F");
     372                        Stats::Time::BlockGuard guard("validate-F");
     373                        Stats::Time::TimeBlock("Fix Object Type", [&]() {
     374                                FixObjectType::fix( translationUnit );
     375                        });
     376                        Stats::Time::TimeBlock("Array Length", [&]() {
     377                                ArrayLength::computeLength( translationUnit );
     378                        });
     379                        Stats::Time::TimeBlock("Find Special Declarations", [&]() {
     380                                acceptAll( translationUnit, finder ); // xxx - remove this pass soon
     381                        });
     382                        Stats::Time::TimeBlock("Fix Label Address", [&]() {
     383                                mutateAll( translationUnit, labelAddrFixer );
     384                        });
     385                        Stats::Time::TimeBlock("Handle Attributes", [&]() {
     386                                Validate::handleAttributes( translationUnit );
     387                        });
     388                }
    330389        }
    331390
  • src/SymTab/module.mk

    r9d9a451 r53bb8f1  
    1515###############################################################################
    1616
    17 SRC += SymTab/Indexer.cc \
    18        SymTab/Mangler.cc \
    19        SymTab/ManglerCommon.cc \
    20        SymTab/Validate.cc \
    21        SymTab/FixFunction.cc \
    22        SymTab/Autogen.cc
     17SRC_SYMTAB = \
     18      SymTab/Autogen.cc \
     19      SymTab/FixFunction.cc \
     20      SymTab/Indexer.cc \
     21      SymTab/Mangler.cc \
     22      SymTab/ManglerCommon.cc \
     23      SymTab/Validate.cc
     24
     25SRC += $(SRC_SYMTAB)
     26SRCDEMANGLE += $(SRC_SYMTAB) SymTab/Demangle.cc
  • src/SynTree/AddressExpr.cc

    r9d9a451 r53bb8f1  
    99// Author           : Richard C. Bilson
    1010// Created On       : Sun May 17 23:54:44 2015
    11 // Last Modified By : Rob Schluntz
    12 // Last Modified On : Tue Apr 26 12:35:13 2016
    13 // Update Count     : 6
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Thu Feb 28 13:13:38 2019
     13// Update Count     : 10
    1414//
    1515
     
    4747                } else {
    4848                        // taking address of non-lvalue -- must be a reference, loses one layer of reference
    49                         ReferenceType * refType = strict_dynamic_cast< ReferenceType * >( arg->result );
    50                         set_result( addrType( refType->base ) );
     49                        if ( ReferenceType * refType = dynamic_cast< ReferenceType * >( arg->result ) ) {
     50                                set_result( addrType( refType->base ) );
     51                        } else {
     52                                SemanticError( arg->result, "Attempt to take address of non-lvalue expression: " );
     53                        } // if
    5154                }
    5255                // result of & is never an lvalue
  • src/SynTree/BasicType.cc

    r9d9a451 r53bb8f1  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Sep 25 14:14:03 2017
    13 // Update Count     : 11
     12// Last Modified On : Thu Jan 31 21:37:36 2019
     13// Update Count     : 12
    1414//
    1515
     
    3030
    3131bool BasicType::isInteger() const {
     32        return kind <= UnsignedInt128;
     33#if 0
    3234        switch ( kind ) {
    3335          case Bool:
     
    6365        assert( false );
    6466        return false;
     67#endif
    6568}
    6669
  • src/SynTree/Constant.cc

    r9d9a451 r53bb8f1  
    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 : Fri Spt 28 14:49:00 2018
    13 // Update Count     : 30
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Wed Feb 13 18:11:22 2019
     13// Update Count     : 32
    1414//
    1515
  • src/SynTree/Expression.cc

    r9d9a451 r53bb8f1  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jul 25 14:15:47 2017
    13 // Update Count     : 54
     12// Last Modified On : Tue Feb 19 18:10:55 2019
     13// Update Count     : 60
    1414//
    1515
     
    3333#include "GenPoly/Lvalue.h"
    3434
    35 void printInferParams( const InferredParams & inferParams, std::ostream &os, Indenter indent, int level ) {
     35void printInferParams( const InferredParams & inferParams, std::ostream & os, Indenter indent, int level ) {
    3636        if ( ! inferParams.empty() ) {
    3737                os << indent << "with inferred parameters " << level << ":" << std::endl;
     
    4747Expression::Expression() : result( 0 ), env( 0 ) {}
    4848
    49 Expression::Expression( const Expression &other ) : BaseSyntaxNode( other ), result( maybeClone( other.result ) ), env( maybeClone( other.env ) ), extension( other.extension ), inferParams( other.inferParams ), resnSlots( other.resnSlots ) {}
     49Expression::Expression( const Expression & other ) : BaseSyntaxNode( other ), result( maybeClone( other.result ) ), env( maybeClone( other.env ) ), extension( other.extension ), inferParams( other.inferParams ), resnSlots( other.resnSlots ) {}
    5050
    5151void Expression::spliceInferParams( Expression * other ) {
     
    6262}
    6363
    64 void Expression::print( std::ostream &os, Indenter indent ) const {
     64void Expression::print( std::ostream & os, Indenter indent ) const {
    6565        printInferParams( inferParams, os, indent+1, 0 );
    6666
     
    7979}
    8080
    81 ConstantExpr::ConstantExpr( const ConstantExpr &other) : Expression( other ), constant( other.constant ) {
     81ConstantExpr::ConstantExpr( const ConstantExpr & other) : Expression( other ), constant( other.constant ) {
    8282}
    8383
    8484ConstantExpr::~ConstantExpr() {}
    8585
    86 void ConstantExpr::print( std::ostream &os, Indenter indent ) const {
     86void ConstantExpr::print( std::ostream & os, Indenter indent ) const {
    8787        os << "constant expression " ;
    8888        constant.print( os );
     
    124124}
    125125
    126 VariableExpr::VariableExpr( const VariableExpr &other ) : Expression( other ), var( other.var ) {
     126VariableExpr::VariableExpr( const VariableExpr & other ) : Expression( other ), var( other.var ) {
    127127}
    128128
     
    137137}
    138138
    139 void VariableExpr::print( std::ostream &os, Indenter indent ) const {
     139void VariableExpr::print( std::ostream & os, Indenter indent ) const {
    140140        os << "Variable Expression: ";
    141141        var->printShort(os, indent);
     
    143143}
    144144
    145 SizeofExpr::SizeofExpr( Expression *expr_ ) :
     145SizeofExpr::SizeofExpr( Expression * expr_ ) :
    146146                Expression(), expr(expr_), type(0), isType(false) {
    147147        set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );
    148148}
    149149
    150 SizeofExpr::SizeofExpr( Type *type_ ) :
     150SizeofExpr::SizeofExpr( Type * type_ ) :
    151151                Expression(), expr(0), type(type_), isType(true) {
    152152        set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );
    153153}
    154154
    155 SizeofExpr::SizeofExpr( const SizeofExpr &other ) :
     155SizeofExpr::SizeofExpr( const SizeofExpr & other ) :
    156156        Expression( other ), expr( maybeClone( other.expr ) ), type( maybeClone( other.type ) ), isType( other.isType ) {
    157157}
     
    162162}
    163163
    164 void SizeofExpr::print( std::ostream &os, Indenter indent) const {
     164void SizeofExpr::print( std::ostream & os, Indenter indent) const {
    165165        os << "Sizeof Expression on: ";
    166166        if (isType) type->print(os, indent+1);
     
    169169}
    170170
    171 AlignofExpr::AlignofExpr( Expression *expr_ ) :
     171AlignofExpr::AlignofExpr( Expression * expr_ ) :
    172172                Expression(), expr(expr_), type(0), isType(false) {
    173173        set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );
    174174}
    175175
    176 AlignofExpr::AlignofExpr( Type *type_ ) :
     176AlignofExpr::AlignofExpr( Type * type_ ) :
    177177                Expression(), expr(0), type(type_), isType(true) {
    178178        set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );
    179179}
    180180
    181 AlignofExpr::AlignofExpr( const AlignofExpr &other ) :
     181AlignofExpr::AlignofExpr( const AlignofExpr & other ) :
    182182        Expression( other ), expr( maybeClone( other.expr ) ), type( maybeClone( other.type ) ), isType( other.isType ) {
    183183}
     
    188188}
    189189
    190 void AlignofExpr::print( std::ostream &os, Indenter indent) const {
     190void AlignofExpr::print( std::ostream & os, Indenter indent) const {
    191191        os << "Alignof Expression on: ";
    192192        if (isType) type->print(os, indent+1);
     
    195195}
    196196
    197 UntypedOffsetofExpr::UntypedOffsetofExpr( Type *type, const std::string &member ) :
     197UntypedOffsetofExpr::UntypedOffsetofExpr( Type * type, const std::string & member ) :
    198198                Expression(), type(type), member(member) {
    199199        assert( type );
     
    201201}
    202202
    203 UntypedOffsetofExpr::UntypedOffsetofExpr( const UntypedOffsetofExpr &other ) :
     203UntypedOffsetofExpr::UntypedOffsetofExpr( const UntypedOffsetofExpr & other ) :
    204204        Expression( other ), type( maybeClone( other.type ) ), member( other.member ) {}
    205205
     
    208208}
    209209
    210 void UntypedOffsetofExpr::print( std::ostream &os, Indenter indent) const {
     210void UntypedOffsetofExpr::print( std::ostream & os, Indenter indent) const {
    211211        os << "Untyped Offsetof Expression on member " << member << " of ";
    212212        type->print(os, indent+1);
     
    214214}
    215215
    216 OffsetofExpr::OffsetofExpr( Type *type, DeclarationWithType *member ) :
     216OffsetofExpr::OffsetofExpr( Type * type, DeclarationWithType * member ) :
    217217                Expression(), type(type), member(member) {
    218218        assert( member );
     
    221221}
    222222
    223 OffsetofExpr::OffsetofExpr( const OffsetofExpr &other ) :
     223OffsetofExpr::OffsetofExpr( const OffsetofExpr & other ) :
    224224        Expression( other ), type( maybeClone( other.type ) ), member( other.member ) {}
    225225
     
    228228}
    229229
    230 void OffsetofExpr::print( std::ostream &os, Indenter indent) const {
     230void OffsetofExpr::print( std::ostream & os, Indenter indent) const {
    231231        os << "Offsetof Expression on member " << member->name << " of ";
    232232        type->print(os, indent+1);
     
    234234}
    235235
    236 OffsetPackExpr::OffsetPackExpr( StructInstType *type ) : Expression(), type( type ) {
     236OffsetPackExpr::OffsetPackExpr( StructInstType * type ) : Expression(), type( type ) {
    237237        assert( type );
    238238        set_result( new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ), 0, false, false ) );
    239239}
    240240
    241 OffsetPackExpr::OffsetPackExpr( const OffsetPackExpr &other ) : Expression( other ), type( maybeClone( other.type ) ) {}
     241OffsetPackExpr::OffsetPackExpr( const OffsetPackExpr & other ) : Expression( other ), type( maybeClone( other.type ) ) {}
    242242
    243243OffsetPackExpr::~OffsetPackExpr() { delete type; }
    244244
    245 void OffsetPackExpr::print( std::ostream &os, Indenter indent ) const {
     245void OffsetPackExpr::print( std::ostream & os, Indenter indent ) const {
    246246        os << "Offset pack expression on ";
    247247        type->print(os, indent+1);
     
    249249}
    250250
    251 AttrExpr::AttrExpr( Expression *attr, Expression *expr_ ) :
     251AttrExpr::AttrExpr( Expression * attr, Expression * expr_ ) :
    252252                Expression(), attr( attr ), expr(expr_), type(0), isType(false) {
    253253}
    254254
    255 AttrExpr::AttrExpr( Expression *attr, Type *type_ ) :
     255AttrExpr::AttrExpr( Expression * attr, Type * type_ ) :
    256256                Expression(), attr( attr ), expr(0), type(type_), isType(true) {
    257257}
    258258
    259 AttrExpr::AttrExpr( const AttrExpr &other ) :
     259AttrExpr::AttrExpr( const AttrExpr & other ) :
    260260                Expression( other ), attr( maybeClone( other.attr ) ), expr( maybeClone( other.expr ) ), type( maybeClone( other.type ) ), isType( other.isType ) {
    261261}
     
    267267}
    268268
    269 void AttrExpr::print( std::ostream &os, Indenter indent) const {
     269void AttrExpr::print( std::ostream & os, Indenter indent) const {
    270270        os << "Attr ";
    271271        attr->print( os, indent+1);
     
    278278}
    279279
    280 CastExpr::CastExpr( Expression *arg, Type *toType, bool isGenerated ) : Expression(), arg(arg), isGenerated( isGenerated ) {
     280CastExpr::CastExpr( Expression * arg, Type * toType, bool isGenerated ) : arg(arg), isGenerated( isGenerated ) {
    281281        set_result(toType);
    282282}
    283283
    284 CastExpr::CastExpr( Expression *arg, bool isGenerated ) : Expression(), arg(arg), isGenerated( isGenerated ) {
     284CastExpr::CastExpr( Expression * arg, bool isGenerated ) : arg(arg), isGenerated( isGenerated ) {
    285285        set_result( new VoidType( Type::Qualifiers() ) );
    286286}
    287287
    288 CastExpr::CastExpr( const CastExpr &other ) : Expression( other ), arg( maybeClone( other.arg ) ), isGenerated( other.isGenerated ) {
     288CastExpr::CastExpr( const CastExpr & other ) : Expression( other ), arg( maybeClone( other.arg ) ), isGenerated( other.isGenerated ) {
    289289}
    290290
     
    293293}
    294294
    295 void CastExpr::print( std::ostream &os, Indenter indent ) const {
    296         os << "Cast of:" << std::endl << indent+1;
     295void CastExpr::print( std::ostream & os, Indenter indent ) const {
     296        os << (isGenerated ? "Generated " : "Explicit ") << "Cast of:" << std::endl << indent+1;
    297297        arg->print(os, indent+1);
    298298        os << std::endl << indent << "... to:";
     
    306306}
    307307
    308 KeywordCastExpr::KeywordCastExpr( Expression *arg, Target target ) : Expression(), arg(arg), target( target ) {
    309 }
    310 
    311 KeywordCastExpr::KeywordCastExpr( const KeywordCastExpr &other ) : Expression( other ), arg( maybeClone( other.arg ) ), target( other.target ) {
     308KeywordCastExpr::KeywordCastExpr( Expression * arg, Target target ) : Expression(), arg(arg), target( target ) {
     309}
     310
     311KeywordCastExpr::KeywordCastExpr( const KeywordCastExpr & other ) : Expression( other ), arg( maybeClone( other.arg ) ), target( other.target ) {
    312312}
    313313
     
    327327}
    328328
    329 void KeywordCastExpr::print( std::ostream &os, Indenter indent ) const {
     329void KeywordCastExpr::print( std::ostream & os, Indenter indent ) const {
    330330        os << "Keyword Cast of:" << std::endl << indent+1;
    331331        arg->print(os, indent+1);
     
    335335}
    336336
    337 VirtualCastExpr::VirtualCastExpr( Expression *arg_, Type *toType ) : Expression(), arg(arg_) {
     337VirtualCastExpr::VirtualCastExpr( Expression * arg_, Type * toType ) : Expression(), arg(arg_) {
    338338        set_result(toType);
    339339}
    340340
    341 VirtualCastExpr::VirtualCastExpr( const VirtualCastExpr &other ) : Expression( other ), arg( maybeClone( other.arg ) ) {
     341VirtualCastExpr::VirtualCastExpr( const VirtualCastExpr & other ) : Expression( other ), arg( maybeClone( other.arg ) ) {
    342342}
    343343
     
    346346}
    347347
    348 void VirtualCastExpr::print( std::ostream &os, Indenter indent ) const {
     348void VirtualCastExpr::print( std::ostream & os, Indenter indent ) const {
    349349        os << "Virtual Cast of:" << std::endl << indent+1;
    350350        arg->print(os, indent+1);
     
    359359}
    360360
    361 UntypedMemberExpr::UntypedMemberExpr( Expression * member, Expression *aggregate ) :
     361UntypedMemberExpr::UntypedMemberExpr( Expression * member, Expression * aggregate ) :
    362362                Expression(), member(member), aggregate(aggregate) {
    363363        assert( aggregate );
    364364}
    365365
    366 UntypedMemberExpr::UntypedMemberExpr( const UntypedMemberExpr &other ) :
     366UntypedMemberExpr::UntypedMemberExpr( const UntypedMemberExpr & other ) :
    367367                Expression( other ), member( maybeClone( other.member ) ), aggregate( maybeClone( other.aggregate ) ) {
    368368}
     
    373373}
    374374
    375 void UntypedMemberExpr::print( std::ostream &os, Indenter indent ) const {
     375void UntypedMemberExpr::print( std::ostream & os, Indenter indent ) const {
    376376        os << "Untyped Member Expression, with field: " << std::endl << indent+1;
    377377        member->print(os, indent+1 );
     
    381381}
    382382
    383 MemberExpr::MemberExpr( DeclarationWithType *member, Expression *aggregate ) :
     383MemberExpr::MemberExpr( DeclarationWithType * member, Expression * aggregate ) :
    384384                Expression(), member(member), aggregate(aggregate) {
    385385        assert( member );
     
    395395}
    396396
    397 MemberExpr::MemberExpr( const MemberExpr &other ) :
     397MemberExpr::MemberExpr( const MemberExpr & other ) :
    398398                Expression( other ), member( other.member ), aggregate( maybeClone( other.aggregate ) ) {
    399399}
     
    404404}
    405405
    406 void MemberExpr::print( std::ostream &os, Indenter indent ) const {
     406void MemberExpr::print( std::ostream & os, Indenter indent ) const {
    407407        os << "Member Expression, with field:" << std::endl;
    408408        os << indent+1;
     
    413413}
    414414
    415 UntypedExpr::UntypedExpr( Expression *function, const std::list<Expression *> &args ) :
     415UntypedExpr::UntypedExpr( Expression * function, const std::list<Expression *> & args ) :
    416416                Expression(), function(function), args(args) {}
    417417
    418 UntypedExpr::UntypedExpr( const UntypedExpr &other ) :
     418UntypedExpr::UntypedExpr( const UntypedExpr & other ) :
    419419                Expression( other ), function( maybeClone( other.function ) ) {
    420420        cloneAll( other.args, args );
     
    455455
    456456
    457 void UntypedExpr::print( std::ostream &os, Indenter indent ) const {
     457void UntypedExpr::print( std::ostream & os, Indenter indent ) const {
    458458        os << "Applying untyped:" << std::endl;
    459459        os << indent+1;
     
    469469}
    470470
    471 NameExpr::NameExpr( const NameExpr &other ) : Expression( other ), name( other.name ) {
     471NameExpr::NameExpr( const NameExpr & other ) : Expression( other ), name( other.name ) {
    472472}
    473473
    474474NameExpr::~NameExpr() {}
    475475
    476 void NameExpr::print( std::ostream &os, Indenter indent ) const {
     476void NameExpr::print( std::ostream & os, Indenter indent ) const {
    477477        os << "Name: " << get_name();
    478478        Expression::print( os, indent );
    479479}
    480480
    481 LogicalExpr::LogicalExpr( Expression *arg1_, Expression *arg2_, bool andp ) :
     481LogicalExpr::LogicalExpr( Expression * arg1_, Expression * arg2_, bool andp ) :
    482482                Expression(), arg1(arg1_), arg2(arg2_), isAnd(andp) {
    483483        set_result( new BasicType( Type::Qualifiers(), BasicType::SignedInt ) );
    484484}
    485485
    486 LogicalExpr::LogicalExpr( const LogicalExpr &other ) :
     486LogicalExpr::LogicalExpr( const LogicalExpr & other ) :
    487487                Expression( other ), arg1( maybeClone( other.arg1 ) ), arg2( maybeClone( other.arg2 ) ), isAnd( other.isAnd ) {
    488488}
     
    493493}
    494494
    495 void LogicalExpr::print( std::ostream &os, Indenter indent )const {
     495void LogicalExpr::print( std::ostream & os, Indenter indent )const {
    496496        os << "Short-circuited operation (" << (isAnd ? "and" : "or") << ") on: ";
    497497        arg1->print(os);
     
    504504                Expression(), arg1(arg1), arg2(arg2), arg3(arg3) {}
    505505
    506 ConditionalExpr::ConditionalExpr( const ConditionalExpr &other ) :
     506ConditionalExpr::ConditionalExpr( const ConditionalExpr & other ) :
    507507                Expression( other ), arg1( maybeClone( other.arg1 ) ), arg2( maybeClone( other.arg2 ) ), arg3( maybeClone( other.arg3 ) ) {
    508508}
     
    514514}
    515515
    516 void ConditionalExpr::print( std::ostream &os, Indenter indent ) const {
     516void ConditionalExpr::print( std::ostream & os, Indenter indent ) const {
    517517        os << "Conditional expression on: " << std::endl << indent+1;
    518518        arg1->print( os, indent+1 );
     
    527527
    528528
    529 void AsmExpr::print( std::ostream &os, Indenter indent ) const {
     529void AsmExpr::print( std::ostream & os, Indenter indent ) const {
    530530        os << "Asm Expression: " << std::endl;
    531531        if ( inout ) inout->print( os, indent+1 );
     
    555555}
    556556
    557 void ImplicitCopyCtorExpr::print( std::ostream &os, Indenter indent ) const {
     557void ImplicitCopyCtorExpr::print( std::ostream & os, Indenter indent ) const {
    558558        os <<  "Implicit Copy Constructor Expression: " << std::endl << indent+1;
    559559        callExpr->print( os, indent+1 );
     
    581581}
    582582
    583 void ConstructorExpr::print( std::ostream &os, Indenter indent ) const {
     583void ConstructorExpr::print( std::ostream & os, Indenter indent ) const {
    584584        os <<  "Constructor Expression: " << std::endl << indent+1;
    585585        callExpr->print( os, indent + 2 );
     
    594594}
    595595
    596 CompoundLiteralExpr::CompoundLiteralExpr( const CompoundLiteralExpr &other ) : Expression( other ), initializer( other.initializer->clone() ) {}
     596CompoundLiteralExpr::CompoundLiteralExpr( const CompoundLiteralExpr & other ) : Expression( other ), initializer( other.initializer->clone() ) {}
    597597
    598598CompoundLiteralExpr::~CompoundLiteralExpr() {
     
    600600}
    601601
    602 void CompoundLiteralExpr::print( std::ostream &os, Indenter indent ) const {
     602void CompoundLiteralExpr::print( std::ostream & os, Indenter indent ) const {
    603603        os << "Compound Literal Expression: " << std::endl << indent+1;
    604604        result->print( os, indent+1 );
     
    608608}
    609609
    610 RangeExpr::RangeExpr( Expression *low, Expression *high ) : low( low ), high( high ) {}
    611 RangeExpr::RangeExpr( const RangeExpr &other ) : Expression( other ), low( other.low->clone() ), high( other.high->clone() ) {}
    612 void RangeExpr::print( std::ostream &os, Indenter indent ) const {
     610RangeExpr::RangeExpr( Expression * low, Expression * high ) : low( low ), high( high ) {}
     611RangeExpr::RangeExpr( const RangeExpr & other ) : Expression( other ), low( other.low->clone() ), high( other.high->clone() ) {}
     612void RangeExpr::print( std::ostream & os, Indenter indent ) const {
    613613        os << "Range Expression: ";
    614614        low->print( os, indent );
     
    618618}
    619619
    620 StmtExpr::StmtExpr( CompoundStmt *statements ) : statements( statements ) {
     620StmtExpr::StmtExpr( CompoundStmt * statements ) : statements( statements ) {
    621621        computeResult();
    622622}
    623 StmtExpr::StmtExpr( const StmtExpr &other ) : Expression( other ), statements( other.statements->clone() ) {
     623StmtExpr::StmtExpr( const StmtExpr & other ) : Expression( other ), statements( other.statements->clone() ) {
    624624        cloneAll( other.returnDecls, returnDecls );
    625625        cloneAll( other.dtors, dtors );
     
    650650        }
    651651}
    652 void StmtExpr::print( std::ostream &os, Indenter indent ) const {
     652void StmtExpr::print( std::ostream & os, Indenter indent ) const {
    653653        os << "Statement Expression: " << std::endl << indent+1;
    654654        statements->print( os, indent+1 );
     
    666666
    667667long long UniqueExpr::count = 0;
    668 UniqueExpr::UniqueExpr( Expression *expr, long long idVal ) : expr( expr ), object( nullptr ), var( nullptr ), id( idVal ) {
     668UniqueExpr::UniqueExpr( Expression * expr, long long idVal ) : expr( expr ), object( nullptr ), var( nullptr ), id( idVal ) {
    669669        assert( expr );
    670670        assert( count != -1 );
     
    674674        }
    675675}
    676 UniqueExpr::UniqueExpr( const UniqueExpr &other ) : Expression( other ), expr( maybeClone( other.expr ) ), object( maybeClone( other.object ) ), var( maybeClone( other.var ) ), id( other.id ) {
     676UniqueExpr::UniqueExpr( const UniqueExpr & other ) : Expression( other ), expr( maybeClone( other.expr ) ), object( maybeClone( other.object ) ), var( maybeClone( other.var ) ), id( other.id ) {
    677677}
    678678UniqueExpr::~UniqueExpr() {
     
    681681        delete var;
    682682}
    683 void UniqueExpr::print( std::ostream &os, Indenter indent ) const {
     683void UniqueExpr::print( std::ostream & os, Indenter indent ) const {
    684684        os << "Unique Expression with id:" << id << std::endl << indent+1;
    685685        expr->print( os, indent+1 );
  • src/SynTree/Expression.h

    r9d9a451 r53bb8f1  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Sep  3 19:23:46 2017
    13 // Update Count     : 48
     12// Last Modified On : Mon Feb 18 18:29:51 2019
     13// Update Count     : 49
    1414//
    1515
     
    195195  public:
    196196        Expression * arg;
    197         bool isGenerated = true; // whether this cast appeared in the source program
     197        bool isGenerated = true; // cast generated implicitly by code generation or explicit in program
    198198
    199199        CastExpr( Expression * arg, bool isGenerated = true );
  • src/SynTree/Type.cc

    r9d9a451 r53bb8f1  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Jun 22 10:17:19 2018
    13 // Update Count     : 39
     12// Last Modified On : Thu Jan 31 21:54:16 2019
     13// Update Count     : 43
    1414//
    1515#include "Type.h"
     
    2525
    2626const char *BasicType::typeNames[] = {
     27#if 0
    2728        "_Bool",
    2829        "char",
     
    4950        "unsigned __int128",
    5051        "__float80",
    51         "__float128"
     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
     68        "_Bool",
     69        "char",
     70        "signed char",
     71        "unsigned char",
     72        "signed short int",
     73        "unsigned short int",
     74        "signed int",
     75        "unsigned int",
     76        "signed long int",
     77        "unsigned long int",
     78        "signed long long int",
     79        "unsigned long long int",
     80        "__int128",
     81        "unsigned __int128",
     82        "_Float16",
     83        "_Float16 _Complex",
     84        "_Float32",
     85        "_Float32 _Complex",
     86        "float",
     87        "float _Complex",
     88        //"float _Imaginary",
     89        "_Float32x",
     90        "_Float32x _Complex",
     91        "_Float64",
     92        "_Float64 _Complex",
     93        "double",
     94        "double _Complex",
     95        //"double _Imaginary",
     96        "_Float64x",
     97        "_Float64x _Complex",
     98        "__float80",
     99        "_Float128",
     100        "_Float128 _Complex",
     101        "__float128",
     102        "long double",
     103        "long double _Complex",
     104        //"long double _Imaginary",
     105        "_Float128x",
     106        "_Float128x _Complex",
    52107};
    53108static_assert(
  • src/SynTree/Type.h

    r9d9a451 r53bb8f1  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Sep 25 14:14:01 2017
    13 // Update Count     : 154
     12// Last Modified On : Thu Feb 14 17:11:24 2019
     13// Update Count     : 169
    1414//
    1515
     
    207207class BasicType : public Type {
    208208  public:
     209        // GENERATED START, DO NOT EDIT
     210        // GENERATED BY BasicTypes-gen.cc
    209211        enum Kind {
    210212                Bool,
     
    220222                LongLongSignedInt,
    221223                LongLongUnsignedInt,
    222                 Float,
    223                 Double,
    224                 LongDouble,
    225                 FloatComplex,
    226                 DoubleComplex,
    227                 LongDoubleComplex,
    228                 FloatImaginary,
    229                 DoubleImaginary,
    230                 LongDoubleImaginary,
    231224                SignedInt128,
    232225                UnsignedInt128,
    233                 Float80,
    234                 Float128,
     226                uFloat16,
     227                uFloat16Complex,
     228                uFloat32,
     229                uFloat32Complex,
     230                Float,
     231                FloatComplex,
     232                uFloat32x,
     233                uFloat32xComplex,
     234                uFloat64,
     235                uFloat64Complex,
     236                Double,
     237                DoubleComplex,
     238                uFloat64x,
     239                uFloat64xComplex,
     240                uuFloat80,
     241                uFloat128,
     242                uFloat128Complex,
     243                uuFloat128,
     244                LongDouble,
     245                LongDoubleComplex,
     246                uFloat128x,
     247                uFloat128xComplex,
    235248                NUMBER_OF_BASIC_TYPES
    236249        } kind;
     250        // GENERATED END
    237251
    238252        static const char *typeNames[];                                         // string names for basic types, MUST MATCH with Kind
  • src/SynTree/module.mk

    r9d9a451 r53bb8f1  
    1515###############################################################################
    1616
    17 SRC += SynTree/Type.cc \
    18        SynTree/VoidType.cc \
    19        SynTree/BasicType.cc \
    20        SynTree/PointerType.cc \
    21        SynTree/ArrayType.cc \
    22        SynTree/ReferenceType.cc \
    23        SynTree/FunctionType.cc \
    24        SynTree/ReferenceToType.cc \
    25        SynTree/TupleType.cc \
    26        SynTree/TypeofType.cc \
    27        SynTree/AttrType.cc \
    28        SynTree/VarArgsType.cc \
    29        SynTree/ZeroOneType.cc \
    30        SynTree/Constant.cc \
    31        SynTree/Expression.cc \
    32        SynTree/TupleExpr.cc \
    33        SynTree/CommaExpr.cc \
    34        SynTree/TypeExpr.cc \
    35        SynTree/ApplicationExpr.cc \
    36        SynTree/AddressExpr.cc \
    37        SynTree/Statement.cc \
    38        SynTree/CompoundStmt.cc \
    39        SynTree/DeclStmt.cc \
    40        SynTree/Declaration.cc \
    41        SynTree/DeclarationWithType.cc \
    42        SynTree/ObjectDecl.cc \
    43        SynTree/FunctionDecl.cc \
    44        SynTree/AggregateDecl.cc \
    45        SynTree/NamedTypeDecl.cc \
    46        SynTree/TypeDecl.cc \
    47        SynTree/Initializer.cc \
    48        SynTree/TypeSubstitution.cc \
    49        SynTree/Attribute.cc \
    50        SynTree/DeclReplacer.cc
     17SRC_SYNTREE = \
     18      SynTree/Type.cc \
     19      SynTree/VoidType.cc \
     20      SynTree/BasicType.cc \
     21      SynTree/PointerType.cc \
     22      SynTree/ArrayType.cc \
     23      SynTree/ReferenceType.cc \
     24      SynTree/FunctionType.cc \
     25      SynTree/ReferenceToType.cc \
     26      SynTree/TupleType.cc \
     27      SynTree/TypeofType.cc \
     28      SynTree/AttrType.cc \
     29      SynTree/VarArgsType.cc \
     30      SynTree/ZeroOneType.cc \
     31      SynTree/Constant.cc \
     32      SynTree/Expression.cc \
     33      SynTree/TupleExpr.cc \
     34      SynTree/CommaExpr.cc \
     35      SynTree/TypeExpr.cc \
     36      SynTree/ApplicationExpr.cc \
     37      SynTree/AddressExpr.cc \
     38      SynTree/Statement.cc \
     39      SynTree/CompoundStmt.cc \
     40      SynTree/DeclStmt.cc \
     41      SynTree/Declaration.cc \
     42      SynTree/DeclarationWithType.cc \
     43      SynTree/ObjectDecl.cc \
     44      SynTree/FunctionDecl.cc \
     45      SynTree/AggregateDecl.cc \
     46      SynTree/NamedTypeDecl.cc \
     47      SynTree/TypeDecl.cc \
     48      SynTree/Initializer.cc \
     49      SynTree/TypeSubstitution.cc \
     50      SynTree/Attribute.cc \
     51      SynTree/DeclReplacer.cc
    5152
     53SRC += $(SRC_SYNTREE)
     54SRCDEMANGLE += $(SRC_SYNTREE)
  • src/Tuples/TupleExpansion.cc

    r9d9a451 r53bb8f1  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jun 21 17:35:04 2017
    13 // Update Count     : 19
     12// Last Modified On : Wed Feb 13 18:14:12 2019
     13// Update Count     : 21
    1414//
    1515
  • src/Tuples/module.mk

    r9d9a451 r53bb8f1  
    1515###############################################################################
    1616
    17 SRC +=  Tuples/TupleAssignment.cc \
    18         Tuples/TupleExpansion.cc \
    19         Tuples/Explode.cc
     17SRC += Tuples/TupleAssignment.cc Tuples/TupleExpansion.cc Tuples/Explode.cc
     18SRCDEMANGLE += Tuples/TupleAssignment.cc Tuples/TupleExpansion.cc Tuples/Explode.cc
  • src/Validate/module.mk

    r9d9a451 r53bb8f1  
    1616
    1717SRC += Validate/HandleAttributes.cc
     18SRCDEMANGLE += Validate/HandleAttributes.cc
  • src/cfa.make

    r9d9a451 r53bb8f1  
    3232am__v_GOC_1 =
    3333
    34 
     34UPPCC = u++
    3535UPPCOMPILE = $(UPPCC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_UPPFLAGS) $(UPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_CFLAGS) $(CFLAGS)
    3636
  • src/config.h.in

    r9d9a451 r53bb8f1  
    5252#undef CFA_VERSION_SHORT
    5353
    54 /* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
    55    systems. This function is required for `alloca.c' support on those systems.
    56    */
    57 #undef CRAY_STACKSEG_END
    58 
    59 /* Define to 1 if using `alloca.c'. */
    60 #undef C_ALLOCA
    61 
    62 /* Define to 1 if you have `alloca', as a function or macro. */
    63 #undef HAVE_ALLOCA
    64 
    65 /* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
    66    */
    67 #undef HAVE_ALLOCA_H
     54/* Have compiler warning cast-function-type. */
     55#undef HAVE_CAST_FUNCTION_TYPE
    6856
    6957/* Define to 1 if you have the <dlfcn.h> header file. */
    7058#undef HAVE_DLFCN_H
    7159
    72 /* Define to 1 if you have the <fenv.h> header file. */
    73 #undef HAVE_FENV_H
    74 
    75 /* Define to 1 if you have the <float.h> header file. */
    76 #undef HAVE_FLOAT_H
    77 
    7860/* Define to 1 if you have the <inttypes.h> header file. */
    7961#undef HAVE_INTTYPES_H
    8062
     63/* Have keywords _FloatXX. */
     64#undef HAVE_KEYWORDS_FLOATXX
     65
    8166/* Define to 1 if you have the <libintl.h> header file. */
    8267#undef HAVE_LIBINTL_H
    83 
    84 /* Define to 1 if you have the <limits.h> header file. */
    85 #undef HAVE_LIMITS_H
    8668
    8769/* Define to 1 if you have the <malloc.h> header file. */
     
    9173#undef HAVE_MEMORY_H
    9274
    93 /* Define to 1 if you have the `memset' function. */
    94 #undef HAVE_MEMSET
    95 
    96 /* Define to 1 if you have the `putenv' function. */
    97 #undef HAVE_PUTENV
    98 
    99 /* Define to 1 if stdbool.h conforms to C99. */
    100 #undef HAVE_STDBOOL_H
    101 
    102 /* Define to 1 if you have the <stddef.h> header file. */
    103 #undef HAVE_STDDEF_H
    104 
    10575/* Define to 1 if you have the <stdint.h> header file. */
    10676#undef HAVE_STDINT_H
     
    10979#undef HAVE_STDLIB_H
    11080
    111 /* Define to 1 if you have the `strchr' function. */
    112 #undef HAVE_STRCHR
    113 
    11481/* Define to 1 if you have the <strings.h> header file. */
    11582#undef HAVE_STRINGS_H
     
    11784/* Define to 1 if you have the <string.h> header file. */
    11885#undef HAVE_STRING_H
    119 
    120 /* Define to 1 if you have the `strtol' function. */
    121 #undef HAVE_STRTOL
    12286
    12387/* Define to 1 if you have the <sys/stat.h> header file. */
     
    13094#undef HAVE_UNISTD_H
    13195
    132 /* Define to 1 if the system has the type `_Bool'. */
    133 #undef HAVE__BOOL
     96/* Define to 1 if the system has the type `_Float32'. */
     97#undef HAVE__FLOAT32
    13498
    13599/* Define to the sub-directory where libtool stores uninstalled libraries. */
     
    157121#undef PACKAGE_VERSION
    158122
    159 /* If using the C implementation of alloca, define if you know the
    160    direction of stack growth for your system; otherwise it will be
    161    automatically deduced at runtime.
    162         STACK_DIRECTION > 0 => grows toward higher addresses
    163         STACK_DIRECTION < 0 => grows toward lower addresses
    164         STACK_DIRECTION = 0 => direction of growth unknown */
    165 #undef STACK_DIRECTION
    166 
    167123/* Define to 1 if you have the ANSI C header files. */
    168124#undef STDC_HEADERS
     
    180136   `char[]'. */
    181137#undef YYTEXT_POINTER
    182 
    183 /* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
    184    <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
    185    #define below would cause a syntax error. */
    186 #undef _UINT32_T
    187 
    188 /* Define for Solaris 2.5.1 so the uint8_t typedef from <sys/synch.h>,
    189    <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
    190    #define below would cause a syntax error. */
    191 #undef _UINT8_T
    192 
    193 /* Define to `__inline__' or `__inline' if that's what the C compiler
    194    calls it, or to nothing if 'inline' is not supported under any name.  */
    195 #ifndef __cplusplus
    196 #undef inline
    197 #endif
    198 
    199 /* Define to the type of a signed integer type of width exactly 16 bits if
    200    such a type exists and the standard includes do not define it. */
    201 #undef int16_t
    202 
    203 /* Define to the type of a signed integer type of width exactly 32 bits if
    204    such a type exists and the standard includes do not define it. */
    205 #undef int32_t
    206 
    207 /* Define to the type of a signed integer type of width exactly 8 bits if such
    208    a type exists and the standard includes do not define it. */
    209 #undef int8_t
    210 
    211 /* Define to the equivalent of the C99 'restrict' keyword, or to
    212    nothing if this is not supported.  Do not define if restrict is
    213    supported directly.  */
    214 #undef restrict
    215 /* Work around a bug in Sun C++: it does not support _Restrict or
    216    __restrict__, even though the corresponding Sun C compiler ends up with
    217    "#define restrict _Restrict" or "#define restrict __restrict__" in the
    218    previous line.  Perhaps some future version of Sun C++ will work with
    219    restrict; if so, hopefully it defines __RESTRICT like Sun C does.  */
    220 #if defined __SUNPRO_CC && !defined __RESTRICT
    221 # define _Restrict
    222 # define __restrict__
    223 #endif
    224 
    225 /* Define to `unsigned int' if <sys/types.h> does not define. */
    226 #undef size_t
    227 
    228 /* Define to the type of an unsigned integer type of width exactly 16 bits if
    229    such a type exists and the standard includes do not define it. */
    230 #undef uint16_t
    231 
    232 /* Define to the type of an unsigned integer type of width exactly 32 bits if
    233    such a type exists and the standard includes do not define it. */
    234 #undef uint32_t
    235 
    236 /* Define to the type of an unsigned integer type of width exactly 8 bits if
    237    such a type exists and the standard includes do not define it. */
    238 #undef uint8_t
  • src/main.cc

    r9d9a451 r53bb8f1  
    1010// Created On       : Fri May 15 23:12:02 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jun  6 15:51:47 2018
    13 // Update Count     : 498
     12// Last Modified On : Sat Feb 16 09:14:04 2019
     13// Update Count     : 500
    1414//
    1515
     
    3737#include "CodeTools/TrackLoc.h"             // for fillLocations
    3838#include "Common/CompilerError.h"           // for CompilerError
    39 #include "Common/Heap.h"
     39#include "Common/Stats.h"
    4040#include "Common/PassVisitor.h"
    4141#include "Common/SemanticError.h"           // for SemanticError
     
    6565using namespace std;
    6666
    67 #define PASS(name, pass)                   \
     67
     68void NewPass(const char * const name) {
     69        Stats::Heap::newPass(name);
     70        using namespace Stats::Counters;
     71        static auto pass_visitor_group = build<CounterGroup>("Pass Visitor");
     72        auto pass = build<CounterGroup>(name, pass_visitor_group);
     73        pass_visitor_stats.depth = 0;
     74        pass_visitor_stats.avg = build<AverageCounter<double>>("Average Depth", pass);
     75        pass_visitor_stats.max = build<MaxCounter<double>>("Max Depth", pass);
     76}
     77
     78#define PASS(name, pass)                  \
    6879        if ( errorp ) { cerr << name << endl; } \
    69         HeapStats::newPass(name);               \
    70         pass;
     80        NewPass(name);                          \
     81        Stats::Time::StartBlock(name);          \
     82        pass;                                   \
     83        Stats::Time::StopBlock();
    7184
    7285LinkageSpec::Spec linkage = LinkageSpec::Cforall;
     
    142155        backtrace( 6 );                                                                         // skip first 6 stack frames
    143156        signal( SIGABRT, SIG_DFL);                                                      // reset default signal handler
    144     raise( SIGABRT );                                                                   // reraise SIGABRT
     157                raise( SIGABRT );                                                                       // reraise SIGABRT
    145158} // sigAbortHandler
    146159
     
    148161int main( int argc, char * argv[] ) {
    149162        FILE * input;                                                                           // use FILE rather than istream because yyin is FILE
    150         ostream *output = & cout;
    151         const char *filename = nullptr;
     163        ostream * output = & cout;
     164        const char * filename = nullptr;
    152165        list< Declaration * > translationUnit;
    153166
     
    181194                } // if
    182195
     196                Stats::Time::StartGlobal();
     197                NewPass("Parse");
     198                Stats::Time::StartBlock("Parse");
     199
    183200                // read in the builtins, extras, and the prelude
    184201                if ( ! nopreludep ) {                                                   // include gcc builtins
     
    231248                // works okay for now.
    232249                CodeTools::fillLocations( translationUnit );
     250                Stats::Time::StopBlock();
    233251
    234252                // add the assignment statement after the initialization of a type parameter
    235                 PASS( "validate", SymTab::validate( translationUnit, symtabp ) );
     253                PASS( "Validate", SymTab::validate( translationUnit, symtabp ) );
    236254                if ( symtabp ) {
    237255                        deleteAll( translationUnit );
     
    250268                } // if
    251269
    252                 PASS( "fixLabels", ControlStruct::fixLabels( translationUnit ) );
    253                 PASS( "fixNames", CodeGen::fixNames( translationUnit ) );
    254                 PASS( "genInit", InitTweak::genInit( translationUnit ) );
    255                 PASS( "expandMemberTuples" , Tuples::expandMemberTuples( translationUnit ) );
     270                PASS( "Fix Labels", ControlStruct::fixLabels( translationUnit ) );
     271                PASS( "Fix Names", CodeGen::fixNames( translationUnit ) );
     272                PASS( "Gen Init", InitTweak::genInit( translationUnit ) );
     273                PASS( "Expand Member Tuples" , Tuples::expandMemberTuples( translationUnit ) );
    256274                if ( libcfap ) {
    257275                        // generate the bodies of cfa library functions
     
    277295                }
    278296
    279                 PASS( "resolve", ResolvExpr::resolve( translationUnit ) );
     297                PASS( "Resolve", ResolvExpr::resolve( translationUnit ) );
    280298                if ( exprp ) {
    281299                        dump( translationUnit );
     
    284302
    285303                // fix ObjectDecl - replaces ConstructorInit nodes
    286                 PASS( "fixInit", InitTweak::fix( translationUnit, buildingLibrary() ) );
     304                PASS( "Fix Init", InitTweak::fix( translationUnit, buildingLibrary() ) );
    287305                if ( ctorinitp ) {
    288306                        dump ( translationUnit );
     
    290308                } // if
    291309
    292                 PASS( "expandUniqueExpr", 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
    293 
    294                 PASS( "translateEHM" , ControlStruct::translateEHM( translationUnit ) );
    295 
    296                 PASS( "generateWaitfor" , Concurrency::generateWaitFor( translationUnit ) );
    297 
    298                 PASS( "convertSpecializations",  GenPoly::convertSpecializations( translationUnit ) ); // needs to happen before tuple types are expanded
    299 
    300                 PASS( "expandTuples", Tuples::expandTuples( translationUnit ) ); // xxx - is this the right place for this?
     310                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
     311
     312                PASS( "Translate EHM" , ControlStruct::translateEHM( translationUnit ) );
     313
     314                PASS( "Gen Waitfor" , Concurrency::generateWaitFor( translationUnit ) );
     315
     316                PASS( "Convert Specializations",  GenPoly::convertSpecializations( translationUnit ) ); // needs to happen before tuple types are expanded
     317
     318                PASS( "Expand Tuples", Tuples::expandTuples( translationUnit ) ); // xxx - is this the right place for this?
    301319
    302320                if ( tuplep ) {
     
    305323                }
    306324
    307                 PASS( "virtual expandCasts", Virtual::expandCasts( translationUnit ) ); // Must come after translateEHM
    308 
    309                 PASS( "instantiateGenerics", GenPoly::instantiateGeneric( translationUnit ) );
     325                PASS( "Virtual Expand Casts", Virtual::expandCasts( translationUnit ) ); // Must come after translateEHM
     326
     327                PASS( "Instantiate Generics", GenPoly::instantiateGeneric( translationUnit ) );
    310328                if ( genericsp ) {
    311329                        dump( translationUnit );
    312330                        return 0;
    313331                }
    314                 PASS( "convertLvalue", GenPoly::convertLvalue( translationUnit ) );
     332                PASS( "Convert L-Value", GenPoly::convertLvalue( translationUnit ) );
    315333
    316334
     
    319337                        return 0;
    320338                } // if
    321                 PASS( "box", GenPoly::box( translationUnit ) );
     339                PASS( "Box", GenPoly::box( translationUnit ) );
    322340
    323341                if ( bcodegenp ) {
     
    331349
    332350                CodeTools::fillLocations( translationUnit );
    333                 PASS( "codegen", CodeGen::generate( translationUnit, *output, ! noprotop, prettycodegenp, true, linemarks ) );
     351                PASS( "Code Gen", CodeGen::generate( translationUnit, *output, ! noprotop, prettycodegenp, true, linemarks ) );
    334352
    335353                CodeGen::FixMain::fix( *output, (PreludeDirector + "/bootloader.c").c_str() );
     
    371389                        }
    372390                } catch(const std::exception& e) {
    373                         std::cerr << "Unaught Exception \"" << e.what() << "\"\n";
     391                        std::cerr << "Uncaught Exception \"" << e.what() << "\"\n";
    374392                }
    375393                return 1;
     
    377395
    378396        deleteAll( translationUnit );
    379         if(!libcfap && !treep) HeapStats::printStats();
     397        Stats::print();
     398
    380399        return 0;
    381400} // main
    382401
    383402void parse_cmdline( int argc, char * argv[], const char *& filename ) {
    384         enum { Ast, Bbox, Bresolver, CtorInitFix, DeclStats, Expr, ExprAlt, Grammar, LibCFA, Linemarks, Nolinemarks, Nopreamble, Parse, PreludeDir, Prototypes, Resolver, ResolvProto, Symbol, Tree, TupleExpansion, Validate, };
     403        enum { Ast, Bbox, Bresolver, CtorInitFix, DeclStats, Expr, ExprAlt, Grammar, LibCFA, Linemarks, Nolinemarks, Nopreamble, Parse, PreludeDir, Prototypes, Resolver, ResolvProto, Stats, Symbol, Tree, TupleExpansion, Validate};
    385404
    386405        static struct option long_opts[] = {
     
    402421                { "resolver", no_argument, 0, Resolver },
    403422                { "resolv-proto", no_argument, 0, ResolvProto },
     423                { "stats", required_argument, 0, Stats },
    404424                { "symbol", no_argument, 0, Symbol },
    405425                { "tree", no_argument, 0, Tree },
     
    416436        while ( (c = getopt_long( argc, argv, "abBcCdefgGlLmnNpqrRstTvwW:yzZD:F:", long_opts, &long_index )) != -1 ) {
    417437                switch ( c ) {
    418                   case Ast:
    419                   case 'a':                                                                             // dump AST
     438                        case Ast:
     439                        case 'a':                                                                               // dump AST
    420440                        astp = true;
    421441                        break;
    422                   case Bresolver:
    423                   case 'b':                                                                             // print before resolver steps
     442                        case Bresolver:
     443                        case 'b':                                                                               // print before resolver steps
    424444                        bresolvep = true;
    425445                        break;
    426                   case 'B':                                                                             // print before box steps
     446                        case 'B':                                                                               // print before box steps
    427447                        bboxp = true;
    428448                        break;
    429                   case CtorInitFix:
    430                   case 'c':                                                                             // print after constructors and destructors are replaced
     449                        case CtorInitFix:
     450                        case 'c':                                                                               // print after constructors and destructors are replaced
    431451                        ctorinitp = true;
    432452                        break;
    433                   case 'C':                                                                             // print before code generation
     453                        case 'C':                                                                               // print before code generation
    434454                        bcodegenp = true;
    435455                        break;
    436                   case DeclStats:
    437                   case 'd':
    438                     declstatsp = true;
    439                         break;
    440                   case Expr:
    441                   case 'e':                                                                             // dump AST after expression analysis
     456                        case DeclStats:
     457                        case 'd':
     458                                declstatsp = true;
     459                        break;
     460                        case Expr:
     461                        case 'e':                                                                               // dump AST after expression analysis
    442462                        exprp = true;
    443463                        break;
    444                   case ExprAlt:
    445                   case 'f':                                                                             // print alternatives for expressions
     464                        case ExprAlt:
     465                        case 'f':                                                                               // print alternatives for expressions
    446466                        expraltp = true;
    447467                        break;
    448                   case Grammar:
    449                   case 'g':                                                                             // bison debugging info (grammar rules)
     468                        case Grammar:
     469                        case 'g':                                                                               // bison debugging info (grammar rules)
    450470                        yydebug = true;
    451471                        break;
    452                   case 'G':                                                                             // dump AST after instantiate generics
     472                        case 'G':                                                                               // dump AST after instantiate generics
    453473                        genericsp = true;
    454474                        break;
    455                   case LibCFA:
    456                   case 'l':                                                                             // generate libcfa.c
     475                        case LibCFA:
     476                        case 'l':                                                                               // generate libcfa.c
    457477                        libcfap = true;
    458478                        break;
    459                   case Linemarks:
    460                   case 'L':                                                                             // print lines marks
     479                        case Linemarks:
     480                        case 'L':                                                                               // print lines marks
    461481                        linemarks = true;
    462482                        break;
    463                   case Nopreamble:
    464                   case 'n':                                                                             // do not read preamble
     483                        case Nopreamble:
     484                        case 'n':                                                                               // do not read preamble
    465485                        nopreludep = true;
    466486                        break;
    467                   case Nolinemarks:
    468                   case 'N':                                                                             // suppress line marks
     487                        case Nolinemarks:
     488                        case 'N':                                                                               // suppress line marks
    469489                        linemarks = false;
    470490                        break;
    471                   case Prototypes:
    472                   case 'p':                                                                             // generate prototypes for preamble functions
     491                        case Prototypes:
     492                        case 'p':                                                                               // generate prototypes for preamble functions
    473493                        noprotop = true;
    474494                        break;
    475                   case PreludeDir:
    476                         PreludeDirector = optarg;
    477                         break;
    478                   case 'm':                                                                             // don't replace the main
    479                         nomainp = true;
    480                         break;
    481                   case Parse:
    482                   case 'q':                                                                             // dump parse tree
     495                        case PreludeDir:
     496                                PreludeDirector = optarg;
     497                        break;
     498                        case 'm':                                                                               // don't replace the main
     499                                nomainp = true;
     500                        break;
     501                        case Parse:
     502                        case 'q':                                                                               // dump parse tree
    483503                        parsep = true;
    484504                        break;
    485                   case Resolver:
    486                   case 'r':                                                                             // print resolver steps
     505                        case Resolver:
     506                        case 'r':                                                                               // print resolver steps
    487507                        resolvep = true;
    488508                        break;
    489                   case 'R':                                                                             // dump resolv-proto instance
     509                        case 'R':                                                                               // dump resolv-proto instance
    490510                        resolvprotop = true;
    491511                        break;
    492                   case Symbol:
    493                   case 's':                                                                             // print symbol table events
     512                        case Stats:
     513                                Stats::parse_params(optarg);
     514                        break;
     515                        case Symbol:
     516                        case 's':                                                                               // print symbol table events
    494517                        symtabp = true;
    495518                        break;
    496                   case Tree:
    497                   case 't':                                                                             // build in tree
     519                        case Tree:
     520                        case 't':                                                                               // build in tree
    498521                        treep = true;
    499522                        break;
    500                   case TupleExpansion:
    501                   case 'T':                                                                             // print after tuple expansion
     523                        case TupleExpansion:
     524                        case 'T':                                                                               // print after tuple expansion
    502525                        tuplep = true;
    503526                        break;
    504                   case 'v':                                                                             // dump AST after decl validation pass
     527                        case 'v':                                                                               // dump AST after decl validation pass
    505528                        validp = true;
    506529                        break;
    507                   case 'w':
     530                        case 'w':
    508531                        Wsuppress = true;
    509532                        break;
    510                   case 'W':
     533                        case 'W':
    511534                        if ( strcmp( optarg, "all" ) == 0 ) {
    512535                                SemanticWarning_EnableAll();
     
    525548                        } // if
    526549                        break;
    527                   case 'y':                                                                             // dump AST on error
     550                        case 'y':                                                                               // dump AST on error
    528551                        errorp = true;
    529552                        break;
    530                   case 'z':                                                                             // dump as codegen rather than AST
     553                        case 'z':                                                                               // dump as codegen rather than AST
    531554                        codegenp = true;
    532555                        break;
     
    534557                        prettycodegenp = true;
    535558                        break;
    536                   case 'D':                                                                             // ignore -Dxxx
    537                         break;
    538                   case 'F':                                                                             // source file-name without suffix
     559                        case 'D':                                                                               // ignore -Dxxx
     560                        break;
     561                        case 'F':                                                                               // source file-name without suffix
    539562                        filename = optarg;
    540563                        break;
    541                   case '?':
     564                        case '?':
    542565                        if ( optopt ) {                                                         // short option ?
    543566                                assertf( false, "Unknown option: -%c\n", (char)optopt );
     
    548571                                __attribute__((fallthrough));
    549572                        #endif
    550                   default:
     573                        default:
    551574                        abort();
    552575                } // switch
  • tests/.expect/castError.txt

    r9d9a451 r53bb8f1  
    1 castError.cfa:7:1 error: Cannot choose between 3 alternatives for expression
    2 Cast of:
     1castError.cfa:21:1 error: Cannot choose between 3 alternatives for expression
     2Explicit Cast of:
    33  Name: f
    44... to:
    55  char Alternatives are:
    6 Cost ( 1, 0, 0, 0, 0, 0 ): Cast of:
     6Cost ( 1, 0, 0, 0, 0, 0, 0 ): Explicit Cast of:
    77     Variable Expression: f: function
    88       accepting unspecified arguments
     
    1616 Environment:
    1717
    18 Cost ( 1, 0, 0, 0, 0, 0 ): Cast of:
     18Cost ( 1, 0, 0, 0, 0, 0, 0 ): Explicit Cast of:
    1919     Variable Expression: f: double
    2020   ... to:
     
    2525 Environment:
    2626
    27 Cost ( 1, 0, 0, 0, 0, 0 ): Cast of:
     27Cost ( 1, 0, 0, 0, 0, 0, 0 ): Explicit Cast of:
    2828     Variable Expression: f: signed int
    2929   ... to:
     
    3535
    3636
     37castError.cfa:26:1 error: Cannot choose between 2 alternatives for expression
     38Generated Cast of:
     39  Comma Expression:
     40    constant expression (3 3: signed int)
     41    Name: v
     42... to: nothing Alternatives are:
     43Cost ( 0, 0, 2, 0, 0, 0, 0 ): Generated Cast of:
     44     Comma Expression:
     45       constant expression (3 3: signed int)
     46       Variable Expression: v: unsigned char
     47   ... to: nothing
     48 (types:
     49   void
     50 )
     51 Environment:
     52
     53Cost ( 0, 0, 2, 0, 0, 0, 0 ): Generated Cast of:
     54     Comma Expression:
     55       constant expression (3 3: signed int)
     56       Variable Expression: v: signed short int
     57   ... to: nothing
     58 (types:
     59   void
     60 )
     61 Environment:
     62
     63
  • tests/.expect/completeTypeError.txt

    r9d9a451 r53bb8f1  
    4545
    4646Alternatives with failing assertions are:
    47 Cost ( 0, 1, 0, 1, -5, 0 ): Application of
     47Cost ( 0, 1, 0, 0, 1, -5, 0 ): Application of
    4848     Variable Expression: baz: forall
    4949       T: sized object type
     
    8787   void
    8888 )
    89  Environment:( _73_0_T ) -> instance of type T (not function type) (no widening)
     89 Environment:( _74_0_T ) -> instance of type T (not function type) (no widening)
    9090
    9191
  • tests/.expect/declarationSpecifier.x64.txt

    r9d9a451 r53bb8f1  
    689689signed int _X4mainFi_iPPKc__1(signed int _X4argci_1, const char **_X4argvPPKc_1){
    690690    __attribute__ ((unused)) signed int _X12_retval_maini_1;
    691     ((void)(_X12_retval_maini_1=((signed int )0)) /* ?{} */);
     691    ((void)(_X12_retval_maini_1=0) /* ?{} */);
    692692    return _X12_retval_maini_1;
    693693    ((void)(_X12_retval_maini_1=0) /* ?{} */);
  • tests/.expect/declarationSpecifier.x86.txt

    r9d9a451 r53bb8f1  
    689689signed int _X4mainFi_iPPKc__1(signed int _X4argci_1, const char **_X4argvPPKc_1){
    690690    __attribute__ ((unused)) signed int _X12_retval_maini_1;
    691     ((void)(_X12_retval_maini_1=((signed int )0)) /* ?{} */);
     691    ((void)(_X12_retval_maini_1=0) /* ?{} */);
    692692    return _X12_retval_maini_1;
    693693    ((void)(_X12_retval_maini_1=0) /* ?{} */);
  • tests/.expect/gccExtensions.x64.txt

    r9d9a451 r53bb8f1  
    162162    signed int _X2m2A0A0i_2[((unsigned long int )10)][((unsigned long int )10)];
    163163    signed int _X2m3A0A0i_2[((unsigned long int )10)][((unsigned long int )10)];
    164     ((void)(_X12_retval_maini_1=((signed int )0)) /* ?{} */);
     164    ((void)(_X12_retval_maini_1=0) /* ?{} */);
    165165    return _X12_retval_maini_1;
    166166    ((void)(_X12_retval_maini_1=0) /* ?{} */);
  • tests/.expect/gccExtensions.x86.txt

    r9d9a451 r53bb8f1  
    162162    signed int _X2m2A0A0i_2[((unsigned int )10)][((unsigned int )10)];
    163163    signed int _X2m3A0A0i_2[((unsigned int )10)][((unsigned int )10)];
    164     ((void)(_X12_retval_maini_1=((signed int )0)) /* ?{} */);
     164    ((void)(_X12_retval_maini_1=0) /* ?{} */);
    165165    return _X12_retval_maini_1;
    166166    ((void)(_X12_retval_maini_1=0) /* ?{} */);
  • tests/.expect/io1.txt

    r9d9a451 r53bb8f1  
    119 6 28 0 7 1 2
    2 1 2 3
    3 123
    4 123
     20 1 2 3
     30123
     40123
    55
    66opening delimiters
  • tests/.expect/loopctrl.txt

    r9d9a451 r53bb8f1  
    191910 8 6 4 2
    2020
     212 4 6 8 10
     222.1 3.8 5.5 7.2 8.9
     2310 8 6 4 2 0
     2412.1 10.4 8.7 7 5.3 3.6
    2125
    2226N N N N N N N N N N
     
    242810 9 8 7 6 5 4 3 2 1
    2529
    26 
    27303 6 9
    28 
    2931
    3032(0 0)(1 1)(2 2)(3 3)(4 4)(5 5)(6 6)(7 7)(8 8)(9 9)
  • tests/.expect/sum.txt

    r9d9a451 r53bb8f1  
     1sum from 5 to 15 is 95, check 95
     2sum from 5 to 15 is 95, check 95
    13sum from 5 to 15 is 95, check 95
    24sum from 5 to 15 is 95, check 95
  • tests/Makefile.in

    r9d9a451 r53bb8f1  
    186186DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
    187187ACLOCAL = @ACLOCAL@
    188 ALLOCA = @ALLOCA@
    189188AMTAR = @AMTAR@
    190189AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
     
    350349am__v_GOC_0 = @echo "  GOC     " $@;
    351350am__v_GOC_1 =
     351UPPCC = u++
    352352UPPCOMPILE = $(UPPCC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_UPPFLAGS) $(UPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_CFLAGS) $(CFLAGS)
    353353AM_V_UPP = $(am__v_UPP_@AM_V@)
  • tests/array.cfa

    r9d9a451 r53bb8f1  
    1 //Testing array declarations
     1//                               -*- Mode: C -*-
     2//
     3// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
     4//
     5// The contents of this file are covered under the licence agreement in the
     6// file "LICENCE" distributed with Cforall.
     7//
     8// array.cfa -- test array declarations
     9//
     10// Author           : Peter A. Buhr
     11// Created On       : Tue Feb 19 21:18:06 2019
     12// Last Modified By : Peter A. Buhr
     13// Last Modified On : Tue Feb 19 21:18:46 2019
     14// Update Count     : 1
     15//
     16
    217int a1[];
    318//int a2[*];
     
    3449}
    3550
    36 //Dummy main
    37 int main(int argc, char const *argv[])
    38 {
    39         return 0;
    40 }
     51int main() {}
     52
     53// Local Variables: //
     54// tab-width: 4 //
     55// compile-command: "cfa array.cfa" //
     56// End: //
  • tests/castError.cfa

    r9d9a451 r53bb8f1  
    1 //Testing some of the invalid casts of chars
     1//
     2// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
     3//
     4// The contents of this file are covered under the licence agreement in the
     5// file "LICENCE" distributed with Cforall.
     6//
     7// castError.cfa -- test invalid casts
     8//
     9// Author           : Peter A. Buhr
     10// Created On       : Tue Feb 19 21:15:39 2019
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Tue Feb 19 21:16:44 2019
     13// Update Count     : 1
     14//
     15
    216int f;
    317
     
    721        (char)f;
    822        (int(*)())f;
     23
     24        unsigned char v;
     25        short int v;
     26        3, v;           // implicit void cast
    927}
    1028
    11 //Dummy main
    12 int main(int argc, char const *argv[])
    13 {
    14         return 0;
    15 }
     29int main() {}
     30
     31// Local Variables: //
     32// tab-width: 4 //
     33// compile-command: "cfa castError.cfa" //
     34// End: //
  • tests/concurrent/examples/boundedBufferEXT.cfa

    r9d9a451 r53bb8f1  
    11//
     2// Cforall Version 1.0.0 Copyright (C) 2018 University of Waterloo
     3//
    24// The contents of this file are covered under the licence agreement in the
    35// file "LICENCE" distributed with Cforall.
     
    810// Created On       : Wed Apr 18 22:52:12 2018
    911// Last Modified By : Peter A. Buhr
    10 // Last Modified On : Tue Dec 11 21:55:02 2018
    11 // Update Count     : 9
     12// Last Modified On : Wed Feb 20 08:36:45 2019
     13// Update Count     : 11
    1214//
    1315
    14 #include <stdlib.hfa>                                                                           // random
     16#include <stdlib.hfa>                                                                   // random
    1517#include <fstream.hfa>
    1618#include <kernel.hfa>
  • tests/concurrent/examples/boundedBufferINT.cfa

    r9d9a451 r53bb8f1  
    11//
     2// Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo
     3//
    24// The contents of this file are covered under the licence agreement in the
    35// file "LICENCE" distributed with Cforall.
     
    810// Created On       : Mon Oct 30 12:45:13 2017
    911// Last Modified By : Peter A. Buhr
    10 // Last Modified On : Tue Dec 11 21:55:45 2018
    11 // Update Count     : 84
     12// Last Modified On : Wed Feb 20 08:37:24 2019
     13// Update Count     : 87
    1214//
    1315
    14 #include <stdlib.hfa>                                                                           // random
     16#include <stdlib.hfa>                                                                   // random
    1517#include <fstream.hfa>
    1618#include <kernel.hfa>
  • tests/concurrent/examples/datingService.cfa

    r9d9a451 r53bb8f1  
    11//
     2// Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo
     3//
    24// The contents of this file are covered under the licence agreement in the
    35// file "LICENCE" distributed with Cforall.
     
    810// Created On       : Mon Oct 30 12:56:20 2017
    911// Last Modified By : Peter A. Buhr
    10 // Last Modified On : Tue Dec 11 21:55:34 2018
    11 // Update Count     : 28
     12// Last Modified On : Wed Feb 20 08:37:12 2019
     13// Update Count     : 30
    1214//
    1315
    14 #include <stdlib.hfa>                                                                           // random
     16#include <stdlib.hfa>                                                                   // random
    1517#include <fstream.hfa>
    1618#include <kernel.hfa>
  • tests/concurrent/examples/matrixSum.cfa

    r9d9a451 r53bb8f1  
    1 //                               -*- Mode: C -*-
    21//
    32// Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo
     
    1110// Created On       : Mon Oct  9 08:29:28 2017
    1211// Last Modified By : Peter A. Buhr
    13 // Last Modified On : Tue Dec 11 21:54:55 2018
    14 // Update Count     : 15
     12// Last Modified On : Wed Feb 20 08:37:53 2019
     13// Update Count     : 16
    1514//
    1615
  • tests/concurrent/examples/quickSort.cfa

    r9d9a451 r53bb8f1  
     1//
     2// Cforall Version 1.0.0 Copyright (C) 2017 University of Waterloo
    13//
    24// The contents of this file are covered under the licence agreement in the
     
    911// Created On       : Wed Dec  6 12:15:52 2017
    1012// Last Modified By : Peter A. Buhr
    11 // Last Modified On : Sat Dec 22 08:44:27 2018
    12 // Update Count     : 168
     13// Last Modified On : Wed Feb 20 08:38:24 2019
     14// Update Count     : 169
    1315//
    1416
  • tests/io1.cfa

    r9d9a451 r53bb8f1  
    1010// Created On       : Wed Mar  2 16:56:02 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Dec 21 16:02:55 2018
    13 // Update Count     : 114
     12// Last Modified On : Mon Mar  4 21:42:47 2019
     13// Update Count     : 115
    1414//
    1515
     
    1919        int x = 3, y = 5, z = 7;
    2020        sout | x * 3 | y + 1 | z << 2 | x == y | (x | y) | (x || y) | (x > z ? 1 : 2);
    21         sout | 1 | 2 | 3;
    22         sout | '1' | '2' | '3';
    23         sout | 1 | "" | 2 | "" | 3;
     21        sout | 0 | 1 | 2 | 3;
     22        sout | '0' | '1' | '2' | '3';
     23        sout | 0 | "" | 1 | "" | 2 | "" | 3;
    2424        sout | nl;
    2525
  • tests/literals.cfa

    r9d9a451 r53bb8f1  
    1010// Created On       : Sat Sep  9 16:34:38 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Dec  4 21:44:01 2018
    13 // Update Count     : 139
    14 //
    15 
     12// Last Modified On : Tue Feb 12 08:07:39 2019
     13// Update Count     : 224
     14//
     15
     16#include <features.h>                                                                   // __GNUC_PREREQ
    1617#ifdef __CFA__
    17 #include <stdint.h>
    1818#include <fstream.hfa>
    1919
     
    151151        -0X0123456789.0123456789P-09;  -0X0123456789.0123456789P-09f;  -0X0123456789.0123456789P-09l;  -0X0123456789.0123456789P-09F;  -0X0123456789.0123456789P-09L;
    152152
     153#if defined(__GNUC__) && __GNUC_PREREQ(7,0)                             // gcc version >= 7
     154// floating with length, gcc f16/f128x unsupported and no prelude code for any _FloatXXx, so they work by conversion to long double
     155
     156        /*  0123456789.f16; */   0123456789.f32;   0123456789.f32x;   0123456789.f64;   0123456789.f64x;   0123456789.W;   0123456789.f128;   0123456789.q;  /*  0123456789.f128x; */
     157        /* +0123456789.f16; */  +0123456789.f32;  +0123456789.f32x;  +0123456789.f64;  +0123456789.f64x;  +0123456789.w;  +0123456789.f128;  +0123456789.Q;  /* +0123456789.f128x; */
     158        /* -0123456789.f16; */  -0123456789.f32;  -0123456789.f32x;  -0123456789.f64;  -0123456789.f64x;  -0123456789.W;  -0123456789.f128;  -0123456789.q;  /* -0123456789.f128x; */
     159
     160        /*  0123456789.e09F16; */    0123456789.e09F32;    0123456789.e09F32x;    0123456789.e09F64;    0123456789.e09F64x;    0123456789.e09W;    0123456789.e09F128;    0123456789.e09q;   /*  .0123456789e09q; */
     161        /* +0123456789.e+09F16; */  +0123456789.e+09F32;  +0123456789.e+09F32x;  +0123456789.e+09F64;  +0123456789.e+09F64x;  +0123456789.e+09w;  +0123456789.e+09F128;  +0123456789.e+09Q;  /* +.0123456789E+09Q; */
     162        /* -0123456789.e-09F16; */  -0123456789.e-09F32;  -0123456789.e-09F32x;  -0123456789.e-09F64;  -0123456789.e-09F64x;  -0123456789.e-09W;  -0123456789.e-09F128;  -0123456789.e-09q;  /* -.0123456789E-09q; */
     163
     164        /*  .0123456789e09F16; */    .0123456789e09F32;    .0123456789e09F32x;    .0123456789e09F64;    .0123456789e09F64x;    .0123456789e09W;    .0123456789e09F128;    .0123456789e09q;   /*  .0123456789e09q; */
     165        /* +.0123456789e+09F16; */  +.0123456789e+09F32;  +.0123456789e+09F32x;  +.0123456789e+09F64;  +.0123456789e+09F64x;  +.0123456789e+09w;  +.0123456789e+09F128;  +.0123456789e+09Q;  /* +.0123456789E+09Q; */
     166        /* -.0123456789e-09F16; */  -.0123456789e-09F32;  -.0123456789e-09F32x;  -.0123456789e-09F64;  -.0123456789e-09F64x;  -.0123456789e-09W;  -.0123456789e-09F128;  -.0123456789e-09q;  /* -.0123456789E-09q; */
     167
     168        /*  0123456789.0123456789F16; */   0123456789.0123456789F32;   0123456789.0123456789F32x;   0123456789.0123456789F64;   0123456789.0123456789F64x;   0123456789.0123456789W;   0123456789.0123456789F128;   0123456789.0123456789q;  /*  0123456789.0123456789q; */
     169        /* +0123456789.0123456789F16; */  +0123456789.0123456789F32;  +0123456789.0123456789F32x;  +0123456789.0123456789F64;  +0123456789.0123456789F64x;  +0123456789.0123456789w;  +0123456789.0123456789F128;  +0123456789.0123456789Q;  /* +0123456789.0123456789Q; */
     170        /* -0123456789.0123456789F16; */  -0123456789.0123456789F32;  -0123456789.0123456789F32x;  -0123456789.0123456789F64;  -0123456789.0123456789F64x;  -0123456789.0123456789W;  -0123456789.0123456789F128;  -0123456789.0123456789q;  /* -0123456789.0123456789q; */
     171
     172        /*  0123456789.0123456789E09F16; */    0123456789.0123456789E09F32;    0123456789.0123456789E09F32x;    0123456789.0123456789E09F64;    0123456789.0123456789E09F64x;    0123456789.0123456789E09W;    0123456789.0123456789E09F128;    0123456789.0123456789E09q;   /*  0123456789.0123456789E09q; */
     173        /* +0123456789.0123456789E+09F16; */  +0123456789.0123456789E+09F32;  +0123456789.0123456789E+09F32x;  +0123456789.0123456789E+09F64;  +0123456789.0123456789E+09F64x;  +0123456789.0123456789E+09w;  +0123456789.0123456789E+09F128;  +0123456789.0123456789E+09Q;  /* +0123456789.0123456789E+09Q; */
     174        /* -0123456789.0123456789E-09F16; */  -0123456789.0123456789E-09F32;  -0123456789.0123456789E-09F32x;  -0123456789.0123456789E-09F64;  -0123456789.0123456789E-09F64x;  -0123456789.0123456789E-09W;  -0123456789.0123456789E-09F128;  -0123456789.0123456789E-09q;  /* -0123456789.0123456789E-09q; */
     175
     176        /*  0x123456789.p09f16; */    0x123456789.p09f32;    0x123456789.p09f32x;    0x123456789.p09f64;    0x123456789.p09f64x;    0x123456789.p09W;    0x123456789.p09f128;    0x123456789.p09q;   /*  0x123456789.p09f128x; */
     177        /* +0x123456789.P+09f16; */  +0x123456789.P+09f32;  +0x123456789.P+09f32x;  +0x123456789.P+09f64;  +0x123456789.P+09f64x;  +0x123456789.P+09w;  +0x123456789.P+09f128;  +0x123456789.P+09Q;  /* +0x123456789.P+09f128x; */
     178        /* -0x123456789.P-09f16; */  -0x123456789.P-09f32;  -0x123456789.P-09f32x;  -0x123456789.P-09f64;  -0x123456789.P-09f64x;  -0x123456789.P-09W;  -0x123456789.P-09f128;  -0x123456789.P-09q;  /* -0x123456789.P-09f128x; */
     179
     180        /*  0x123456789.p09F16; */    0x123456789.p09F32;    0x123456789.p09F32x;    0x123456789.p09F64;    0x123456789.p09F64x;    0x123456789.p09W;    0x123456789.p09F128;    0x123456789.p09q;   /*  .0123456789p09q; */
     181        /* +0x123456789.p+09F16; */  +0x123456789.p+09F32;  +0x123456789.p+09F32x;  +0x123456789.p+09F64;  +0x123456789.p+09F64x;  +0x123456789.p+09w;  +0x123456789.p+09F128;  +0x123456789.p+09Q;  /* +.0123456789p+09Q; */
     182        /* -0x123456789.p-09F16; */  -0x123456789.p-09F32;  -0x123456789.p-09F32x;  -0x123456789.p-09F64;  -0x123456789.p-09F64x;  -0x123456789.p-09W;  -0x123456789.p-09F128;  -0x123456789.p-09q;  /* -.0123456789P-09q; */
     183
     184        /*  0X.0123456789p09F16; */    0X.0123456789p09F32;    0X.0123456789p09F32x;    0X.0123456789p09F64;    0X.0123456789p09F64x;    0X.0123456789p09W;    0X.0123456789p09F128;    0X.0123456789p09q;   /*  0X.0123456789p09q; */
     185        /* +0X.0123456789p+09F16; */  +0X.0123456789p+09F32;  +0X.0123456789p+09F32x;  +0X.0123456789p+09F64;  +0X.0123456789p+09F64x;  +0X.0123456789p+09w;  +0X.0123456789p+09F128;  +0X.0123456789p+09Q;  /* +0X.0123456789p+09Q; */
     186        /* -0X.0123456789p-09F16; */  -0X.0123456789p-09F32;  -0X.0123456789p-09F32x;  -0X.0123456789p-09F64;  -0X.0123456789p-09F64x;  -0X.0123456789p-09W;  -0X.0123456789p-09F128;  -0X.0123456789p-09q;  /* -0X.0123456789P-09q; */
     187
     188        /*  0x123456789.0123456789P09F16; */    0x123456789.0123456789P09F32;    0x123456789.0123456789P09F32x;    0x123456789.0123456789P09F64;    0x123456789.0123456789P09F64x;    0x123456789.0123456789P09W;    0x123456789.0123456789P09F128;    0x123456789.0123456789P09q;   /*  0x123456789.0123456789P09q; */
     189        /* +0x123456789.0123456789P+09F16; */  +0x123456789.0123456789P+09F32;  +0x123456789.0123456789P+09F32x;  +0x123456789.0123456789P+09F64;  +0x123456789.0123456789P+09F64x;  +0x123456789.0123456789P+09w;  +0x123456789.0123456789P+09F128;  +0x123456789.0123456789P+09Q;  /* +0x123456789.0123456789P+09Q; */
     190        /* -0x123456789.0123456789p-09F16; */  -0x123456789.0123456789p-09F32;  -0x123456789.0123456789p-09F32x;  -0x123456789.0123456789p-09F64;  -0x123456789.0123456789p-09F64x;  -0x123456789.0123456789p-09W;  -0x123456789.0123456789p-09F128;  -0x123456789.0123456789p-09q;  /* -0x123456789.0123456789p-09q; */
     191
     192        /*  0x123456789.0123456789P09F16; */    0x123456789.0123456789P09F32;    0x123456789.0123456789P09F32x;    0x123456789.0123456789P09F64;    0x123456789.0123456789P09F64x;    0x123456789.0123456789P09W;    0x123456789.0123456789P09F128;    0x123456789.0123456789P09q;   /*  0x123456789.0123456789P09q; */
     193        /* +0x123456789.0123456789p+09F16; */  +0x123456789.0123456789p+09F32;  +0x123456789.0123456789p+09F32x;  +0x123456789.0123456789p+09F64;  +0x123456789.0123456789p+09F64x;  +0x123456789.0123456789p+09w;  +0x123456789.0123456789p+09F128;  +0x123456789.0123456789p+09Q;  /* +0x123456789.0123456789p+09Q; */
     194        /* -0x123456789.0123456789P-09F16; */  -0x123456789.0123456789P-09F32;  -0x123456789.0123456789P-09F32x;  -0x123456789.0123456789P-09F64;  -0x123456789.0123456789P-09F64x;  -0x123456789.0123456789P-09W;  -0x123456789.0123456789P-09F128;  -0x123456789.0123456789P-09q;  /* -0x123456789.0123456789P-09q; */
     195#endif // __GNUC_PREREQ(7,0)
     196
    153197#ifdef __CFA__
    154198// fixed-size length
     
    167211        // octal
    168212         01234567_l8;   01234567_l16;   01234567_l32;   01234567_l64;   01234567_l8u;   01234567_ul16;   01234567_l32u;   01234567_ul64;
    169         +01234567_l8;  +01234567_l16;  +01234567_l32;  +01234567_l64;  +01234567_l8u;  +01234567_ul16;  +01234567_l32u;  +01234567_ul64;
     213        +01234567_l8;  +01234567_l16;  +01234567_l32;  +01234567_l64;  +01234567_ul8;  +01234567_ul16;  +01234567_l32u;  +01234567_ul64;
    170214        -01234567_l8;  -01234567_l16;  -01234567_l32;  -01234567_l64;  -01234567_l8u;  -01234567_ul16;  -01234567_l32u;  -01234567_ul64;
    171215
     
    203247        +0X0123456789ABCDEF_l8;  +0X0123456789ABCDEF_l16;  +0X0123456789ABCDEFl32;  +0X0123456789ABCDEFl64;  +0X0123456789ABCDEF_ul8;  +0X0123456789ABCDEF_l16u;  +0X0123456789ABCDEFul32;  +0X0123456789ABCDEFl64u;
    204248        -0X0123456789ABCDEF_l8;  -0X0123456789ABCDEF_l16;  -0X0123456789ABCDEFl32;  -0X0123456789ABCDEFl64;  -0X0123456789ABCDEF_ul8;  -0X0123456789ABCDEF_l16u;  -0X0123456789ABCDEFul32;  -0X0123456789ABCDEFl64u;
    205 
    206         // floating
    207          0123456789.l32;   0123456789.l64;   0123456789.l80;   0123456789.l128;
    208         +0123456789.l32;  +0123456789.l64;  +0123456789.l80;  +0123456789.l128;
    209         -0123456789.l32;  -0123456789.l64;  -0123456789.l80;  -0123456789.l128;
    210 
    211          0123456789.e09L32;    0123456789.e09L64;    0123456789.e09L80;    0123456789.e09L128;
    212         +0123456789.e+09L32;  +0123456789.e+09L64;  +0123456789.e+09L80;  +0123456789.e+09L128;
    213         -0123456789.e-09L32;  -0123456789.e-09L64;  -0123456789.e-09L80;  -0123456789.e-09L128;
    214 
    215          .0123456789e09L32;    .0123456789e09L64;    .0123456789e09L80;    .0123456789e09L128;
    216         +.0123456789E+09L32;  +.0123456789E+09L64;  +.0123456789E+09L80;  +.0123456789E+09L128;
    217         -.0123456789E-09L32;  -.0123456789E-09L64;  -.0123456789E-09L80;  -.0123456789E-09L128;
    218 
    219          0123456789.0123456789L32;       0123456789.0123456789L64;       0123456789.0123456789L80;       0123456789.0123456789L128;
    220         +0123456789.0123456789E09L32;   +0123456789.0123456789E09L64;   +0123456789.0123456789E09L80;   +0123456789.0123456789E09L128;
    221         -0123456789.0123456789E+09L32;  -0123456789.0123456789E+09L64;  -0123456789.0123456789E+09L80;  -0123456789.0123456789E+09L128;
    222          0123456789.0123456789E-09L32;   0123456789.0123456789E-09L64;   0123456789.0123456789E-09L80;   0123456789.0123456789E-09L128;
    223 
    224          0x0123456789.p09l32;   0x0123456789.p09l64;   0x0123456789.p09l80;   0x0123456789.p09l128;
    225         +0x0123456789.p09l32;  +0x0123456789.p09l64;  +0x0123456789.p09l80;  +0x0123456789.p09l128;
    226         -0x0123456789.p09l32;  -0x0123456789.p09l64;  -0x0123456789.p09l80;  -0x0123456789.p09l128;
    227 
    228          0x0123456789.p+09l32;   0x0123456789.p+09L64;   0x0123456789.p+09L80;   0x0123456789.p+09L128;
    229         +0x0123456789.p-09l32;  +0x0123456789.p-09L64;  +0x0123456789.p-09L80;  +0x0123456789.p-09L128;
    230         -0x.0123456789p09l32;   -0x.0123456789p09L64;   -0x.0123456789p09L80;   -0x.0123456789p09L128;
    231249
    232250// char, short, int suffix overloading
  • tests/loopctrl.cfa

    r9d9a451 r53bb8f1  
    1010// Created On       : Wed Aug  8 18:32:59 2018
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Dec 23 23:00:29 2018
    13 // Update Count     : 79
     12// Last Modified On : Thu Feb 21 08:54:47 2019
     13// Update Count     : 86
    1414//
    1515
     
    5454        for ( i; 5.5 -~ 0.5 ) { sout | i; }                                     sout | nl;
    5555        for ( ui; 2u ~= 10u ~ 2u ) { sout | ui; }                       sout | nl;
    56         for ( ui; 10u -~= 2u ~ 2u ) { sout | ui; }                      sout | nl | nl | nl;
     56        for ( ui; 10u -~= 2u ~ 2u ) { sout | ui; }                      sout | nl | nl;
    5757
     58        for ( i; 2 ~ @ ~ 2 ) {
     59          if ( i > 10 ) break;
     60                sout | i;
     61        }                                                                                                       sout | nl;
     62        for ( i; 2.1 ~ @ ~ @ ) {
     63          if ( i > 10.5 ) break;
     64                sout | i;
     65                i += 1.7;
     66        }                                                                                                       sout | nl;
     67        for ( i; 10 -~ @ ~ 2 ) {
     68          if ( i < 0 ) break;
     69                sout | i;
     70        }                                                                                                       sout | nl;
     71        for ( i; 12.1 ~ @ ~ @ ) {
     72          if ( i < 2.5 ) break;
     73                sout | i;
     74                i -= 1.7;
     75        }                                                                                                       sout | nl | nl;
     76       
    5877        enum { N = 10 };
    5978        for ( N ) { sout | "N"; }                                                       sout | nl;
    6079        for ( i; N ) { sout | i; }                                                      sout | nl;
    61         for ( i; N -~ 0 ) { sout | i; }                                         sout | nl | nl | nl;
     80        for ( i; N -~ 0 ) { sout | i; }                                         sout | nl | nl;
    6281
    6382        const int start = 3, comp = 10, inc = 2;
    6483        for ( i; start ~ comp ~ inc + 1 ) { sout | i; }         sout | nl | nl;
    6584
    66         sout | nl;
    6785        for ( S s = (S){0}; s < (S){10,10}; s += (S){1} ) { sout | s; } sout | nl;
    6886        for ( s; (S){10,10} ) { sout | s; } sout | nl;
  • tests/numericConstants.cfa

    r9d9a451 r53bb8f1  
    1010// Created On       : Wed May 24 22:10:36 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Nov  6 17:59:53 2018
    13 // Update Count     : 3
     12// Last Modified On : Tue Feb  5 08:58:16 2019
     13// Update Count     : 5
    1414//
    1515
     
    6767// Local Variables: //
    6868// tab-width: 4 //
    69 // compile-command: "cfa minmax.cfa" //
     69// compile-command: "cfa numericConstants.cfa" //
    7070// End: //
  • tests/preempt_longrun/Makefile.in

    r9d9a451 r53bb8f1  
    334334DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
    335335ACLOCAL = @ACLOCAL@
    336 ALLOCA = @ALLOCA@
    337336AMTAR = @AMTAR@
    338337AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
  • tests/pybin/tools.py

    r9d9a451 r53bb8f1  
    33import __main__
    44import argparse
     5import fileinput
    56import multiprocessing
    67import os
    78import re
     9import resource
    810import signal
    911import stat
    1012import sys
    11 import fileinput
     13import time
    1214
    1315from pybin import settings
     
    131133
    132134    return None
     135
     136def run(exe, output, input):
     137        ret, _ = sh("timeout %d %s > %s 2>&1" % (settings.timeout.single, exe, output), input = input)
     138        return ret
     139
    133140################################################################################
    134141#               file handling
    135142################################################################################
     143# move a file
     144def mv(source, dest):
     145        ret, _ = sh("mv %s %s" % (source, dest))
     146        return ret
     147
     148# cat one file into the other
     149def cat(source, dest):
     150        ret, _ = sh("cat %s > %s" % (source, dest))
     151        return ret
    136152
    137153# helper function to replace patterns in a file
     
    230246                signal.signal(signal.SIGINT, signal.SIG_IGN)
    231247
     248
     249# enable core dumps for all the test children
     250resource.setrlimit(resource.RLIMIT_CORE, (resource.RLIM_INFINITY, resource.RLIM_INFINITY))
     251
    232252################################################################################
    233253#               misc
     
    251271        else:
    252272                print(text)
     273
     274
     275def coreInfo(path):
     276        cmd   = os.path.join(settings.SRCDIR, "pybin/print-core.gdb")
     277        if not os.path.isfile(cmd):
     278                return 1, "ERR Printing format for core dumps not found"
     279
     280        dname = os.path.dirname(path)
     281        core  = os.path.join(dname, "core" )
     282        if not os.path.isfile(path):
     283                return 1, "ERR Executable path is wrong"
     284
     285        if not os.path.isfile(core):
     286                return 1, "ERR No core dump"
     287
     288        return sh("gdb -n %s %s -batch -x %s" % (path, core, cmd), print2stdout=False)
     289
     290class Timed:
     291    def __enter__(self):
     292        self.start = time.time()
     293        return self
     294
     295    def __exit__(self, *args):
     296        self.end = time.time()
     297        self.duration = self.end - self.start
  • tests/raii/.expect/ctor-autogen-ERR1.txt

    r9d9a451 r53bb8f1  
    1 raii/ctor-autogen.cfa:102:1 error: Unique best alternative includes deleted identifier in Cast of:
     1raii/ctor-autogen.cfa:102:1 error: Unique best alternative includes deleted identifier in Generated Cast of:
    22  Application of
    33    Deleted Expression
     
    2727
    2828            ... to arguments
    29               Cast of:
     29              Generated Cast of:
    3030                Member Expression, with field:
    3131                  x: signed int
    3232                ... from aggregate:
    33                   Cast of:
     33                  Generated Cast of:
    3434                    Variable Expression: m: reference to instance of struct Managed with body 1
    3535                  ... to:
     
    3737              ... to:
    3838                reference to signed int
    39               Cast of:
     39              Generated Cast of:
    4040                constant expression (0 0: zero_t)
    4141              ... to:
     
    4848
    4949  ... to arguments
    50     Cast of:
     50    Generated Cast of:
    5151      Variable Expression: x: instance of struct Managed with body 1
    5252    ... to:
  • tests/sum.cfa

    r9d9a451 r53bb8f1  
    1111// Created On       : Wed May 27 17:56:53 2015
    1212// Last Modified By : Peter A. Buhr
    13 // Last Modified On : Sun Dec 23 23:00:38 2018
    14 // Update Count     : 287
     13// Last Modified On : Wed Feb 20 08:32:46 2019
     14// Update Count     : 329
    1515//
    1616
    1717#include <fstream.hfa>
    1818#include <stdlib.hfa>
    19 
    20 void ?{}( int & c, zero_t ) { c = 0; }                                  // not in prelude
    2119
    2220trait sumable( otype T ) {
     
    3634} // sum
    3735
    38 // Not in prelude.
    39 unsigned char ?+?( unsigned char t1, unsigned char t2 ) { return (int)t1 + t2; } // cast forces integer addition, otherwise recursion
    40 unsigned char ?+=?( unsigned char & t1, unsigned char t2 ) { t1 = t1 + t2; return t1; }
    41 unsigned char ++?( unsigned char & t ) { t += 1; return t; }
    42 unsigned char ?++( unsigned char & t ) { unsigned char temp = t; t += 1; return temp; }
    43 
    44 // Not in prelude.
    45 void ?{}( unsigned char & c, zero_t ) { c = 0; }
    46 void ?{}( float & f, zero_t ) { f = 0.0; }
    47 void ?{}( double & d, zero_t ) { d = 0.0; }
    48 
    4936int main( void ) {
    5037        const int low = 5, High = 15, size = High - low;
    5138
    52         unsigned char s = 0, a[size], v = (char)low;
    53         for ( int i = 0; i < size; i += 1, v += 1 ) {
     39        signed char s = 0, a[size], v = (char)low;
     40        for ( int i = 0; i < size; i += 1, v += 1hh ) {
    5441                s += v;
    5542                a[i] = v;
    5643        } // for
    5744        sout | "sum from" | low | "to" | High | "is"
    58                  | sum( size, (unsigned char *)a ) | ", check" | (int)s;
     45                 | sum( size, (signed char *)a ) | ", check" | (signed char)s;
     46
     47        unsigned char s = 0, a[size], v = low;
     48        for ( int i = 0; i < size; i += 1, v += 1hhu ) {
     49                s += (unsigned char)v;
     50                a[i] = (unsigned char)v;
     51        } // for
     52        sout | "sum from" | low | "to" | High | "is"
     53                 | sum( size, (unsigned char *)a ) | ", check" | (unsigned char)s;
     54
     55        short int s = 0, a[size], v = low;
     56        for ( int i = 0; i < size; i += 1, v += 1h ) {
     57                s += (short int)v;
     58                a[i] = (short int)v;
     59        } // for
     60        sout | "sum from" | low | "to" | High | "is"
     61                 | sum( size, (short int *)a ) | ", check" | (short int)s;
    5962
    6063        int s = 0, a[size], v = low;
  • tests/test.py

    r9d9a451 r53bb8f1  
    121121#               running test functions
    122122################################################################################
    123 # fix the absolute paths in the output
    124 def fixoutput( fname ):
    125         if not is_ascii(fname):
    126                 return
    127 
    128         file_replace(fname, "%s/" % settings.SRCDIR, "")
    129 
     123def success(val):
     124        return val == 0 or settings.dry_run
     125
     126def isExe(file):
     127        return settings.dry_run or fileIsExecutable(file)
     128
     129def noRule(file, target):
     130        return not settings.dry_run and fileContainsOnly(file, "make: *** No rule to make target `%s'.  Stop." % target)
    130131
    131132# logic to run a single test and return the result (No handling of printing or other test framework logic)
     
    143144
    144145        # build, skipping to next test on error
    145         before = time.time()
    146         make_ret, _ = make( test.target(),
    147                 redirects  = "2> %s 1> /dev/null" % out_file,
    148                 error_file = err_file
    149         )
    150         after = time.time()
    151 
    152         comp_dur = after - before
    153 
     146        with Timed() as comp_dur:
     147                make_ret, _ = make( test.target(),      redirects  = ("2> %s 1> /dev/null" % out_file), error_file = err_file )
     148
     149        # if the make command succeds continue otherwise skip to diff
    154150        run_dur = None
    155 
    156         # if the make command succeds continue otherwise skip to diff
    157         if make_ret == 0 or settings.dry_run:
    158                 before = time.time()
    159                 if settings.dry_run or fileIsExecutable(exe_file) :
    160                         # run test
    161                         retcode, _ = sh("timeout %d %s > %s 2>&1" % (settings.timeout.single, exe_file, out_file), input = in_file)
    162                 else :
    163                         # simply cat the result into the output
    164                         retcode, _ = sh("cat %s > %s" % (exe_file, out_file))
    165 
    166                 after = time.time()
    167                 run_dur = after - before
     151        if success(make_ret):
     152                with Timed() as run_dur:
     153                        if isExe(exe_file):
     154                                # run test
     155                                retcode = run(exe_file, out_file, in_file)
     156                        else :
     157                                # simply cat the result into the output
     158                                retcode = cat(exe_file, out_file)
    168159        else:
    169                 retcode, _ = sh("mv %s %s" % (err_file, out_file))
    170 
    171 
    172         if retcode == 0:
    173                 # fixoutput(out_file)
     160                retcode = mv(err_file, out_file)
     161
     162        if success(retcode):
    174163                if settings.generating :
    175164                        # if we are ounly generating the output we still need to check that the test actually exists
    176                         if not settings.dry_run and fileContainsOnly(out_file, "make: *** No rule to make target `%s'.  Stop." % test.target()) :
    177                                 retcode = 1;
     165                        if noRule(out_file, test.target()) :
     166                                retcode = 1
    178167                                error = "\t\tNo make target for test %s!" % test.target()
    179                                 sh("rm %s" % out_file, False)
     168                                rm(out_file)
    180169                        else:
    181170                                error = None
     
    188177                        error = myfile.read()
    189178
     179                ret, info = coreInfo(exe_file)
     180                error = error + info
     181
     182
    190183
    191184        # clean the executable
    192         sh("rm -f %s > /dev/null 2>&1" % test.target())
    193 
    194         return retcode, error, [comp_dur, run_dur]
     185        rm(exe_file)
     186
     187        return retcode, error, [comp_dur.duration, run_dur.duration if run_dur else None]
    195188
    196189# run a single test and handle the errors, outputs, printing, exception handling, etc.
     
    199192        with SignalHandling():
    200193                # print formated name
    201                 name_txt = "%20s  " % t.name
     194                name_txt = "%24s  " % t.name
    202195
    203196                retcode, error, duration = run_single_test(t)
     
    263256        allTests = listTests( options.include, options.exclude )
    264257
     258
    265259        # if user wants all tests than no other treatement of the test list is required
    266260        if options.all or options.list or options.list_comp or options.include :
  • tests/warnings/.expect/self-assignment.txt

    r9d9a451 r53bb8f1  
    1 warnings/self-assignment.cfa:29:1 warning: self assignment of expression: Cast of:
     1warnings/self-assignment.cfa:29:1 warning: self assignment of expression: Generated Cast of:
    22  Variable Expression: j: signed int
    33... to:
    44  reference to signed int
    5 warnings/self-assignment.cfa:30:1 warning: self assignment of expression: Cast of:
     5warnings/self-assignment.cfa:30:1 warning: self assignment of expression: Generated Cast of:
    66  Variable Expression: s: instance of struct S with body 1
    77... to:
    88  reference to instance of struct S with body 1
    9 warnings/self-assignment.cfa:31:1 warning: self assignment of expression: Cast of:
     9warnings/self-assignment.cfa:31:1 warning: self assignment of expression: Generated Cast of:
    1010  Member Expression, with field:
    1111    i: signed int
     
    1414... to:
    1515  reference to signed int
    16 warnings/self-assignment.cfa:32:1 warning: self assignment of expression: Cast of:
     16warnings/self-assignment.cfa:32:1 warning: self assignment of expression: Generated Cast of:
    1717  Member Expression, with field:
    1818    i: signed int
  • tests/warnings/self-assignment.cfa

    r9d9a451 r53bb8f1  
    99// Author           : Rob Schluntz
    1010// Created On       : Thu Mar 1 13:53:57 2018
    11 // Last Modified By : Rob Schluntz
    12 // Last Modified On : Thu Mar 1 13:53:57 2018
    13 // Update Count     : 2
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Wed Feb 20 07:56:17 2019
     13// Update Count     : 3
    1414//
    1515
    1616struct S {
    17   int i;
     17        int i;
    1818};
    1919
    2020struct T {
    21   S s;
     21        S s;
    2222};
    2323
    2424int main() {
    25   int j = 0;
    26   S s = { 0 };
    27   T t = { { 0 } };
     25        int j = 0;
     26        S s = { 0 };
     27        T t = { { 0 } };
    2828
    29   j = j;
    30   s = s;
    31   s.i = s.i;
    32   t.s.i = t.s.i;
     29        j = j;
     30        s = s;
     31        s.i = s.i;
     32        t.s.i = t.s.i;
    3333}
    3434
  • tools/Makefile.in

    r9d9a451 r53bb8f1  
    194194DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
    195195ACLOCAL = @ACLOCAL@
    196 ALLOCA = @ALLOCA@
    197196AMTAR = @AMTAR@
    198197AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
  • tools/PrettyGitLogs.sh

    r9d9a451 r53bb8f1  
    33set -e
    44
    5 GIT_UPDATE="$1/GIT_UPDATE"
    6 GIT_LOG="$1/GIT_LOG"
    7 GIT_DIFF="$1/GIT_DIFF"
     5GIT="git --git-dir=$1/.git"
     6
     7GIT_UPDATE="$2/GIT_UPDATE"
     8GIT_LOG="$2/GIT_LOG"
     9GIT_DIFF="$2/GIT_DIFF"
    810
    911rm -f ${GIT_UPDATE}  ${GIT_LOG}  ${GIT_DIFF}
    1012
    11 GitOldRef=$2
    12 GitNewRef=$3
     13GitOldRef=$3
     14GitNewRef=$4
    1315
    1416
  • tools/prettyprinter/Makefile.in

    r9d9a451 r53bb8f1  
    223223DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
    224224ACLOCAL = @ACLOCAL@
    225 ALLOCA = @ALLOCA@
    226225AMTAR = @AMTAR@
    227226AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
Note: See TracChangeset for help on using the changeset viewer.