Changeset 884f140


Ignore:
Timestamp:
Jul 19, 2019, 4:52:59 PM (2 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
arm-eh, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr
Children:
b5ce31e, fd642d2
Parents:
e723100 (diff), 335d81f (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

Files:
4 added
28 edited

Legend:

Unmodified
Added
Removed
  • driver/cfa.cc

    re723100 r884f140  
    405405                args[nargs] = "--undefined=__cfaabi_appready_startup";
    406406                nargs += 1;
    407                 args[nargs] = "-Xlinker";
    408                 nargs += 1;
    409                 args[nargs] = "--undefined=__cfaabi_dbg_record";
    410                 nargs += 1;
    411407
    412408                // include the cfa library in case it's needed
     
    414410                nargs += 1;
    415411                args[nargs] = ( *new string( string("-Wl,-rpath," ) + libdir + (intree ? "/src/.libs" : "")) ).c_str();
     412                nargs += 1;
     413                args[nargs] = "-Wl,--push-state,--as-needed";
     414                nargs += 1;
     415                args[nargs] = "-lcfathread";
     416                nargs += 1;
     417                args[nargs] = "-Wl,--pop-state";
    416418                nargs += 1;
    417419                args[nargs] = "-lcfa";
  • libcfa/src/Makefile.am

    re723100 r884f140  
    2222
    2323libdir = ${CFA_LIBDIR}
    24 lib_LTLIBRARIES = libcfa.la
     24lib_LTLIBRARIES = libcfa.la libcfathread.la
    2525
    2626VPATH += :../prelude
     
    4141          containers/maybe.hfa containers/pair.hfa containers/result.hfa containers/vector.hfa
    4242
    43 # not all platforms support concurrency, add option do disable it
    44 headers_nosrc += concurrency/invoke.h
    45 headers += concurrency/coroutine.hfa concurrency/thread.hfa concurrency/kernel.hfa concurrency/monitor.hfa concurrency/mutex.hfa
    46 
    4743libsrc = startup.cfa interpose.cfa bits/debug.cfa assert.cfa exception.c virtual.c heap.cfa ${headers:.hfa=.cfa}
    4844
    4945# not all platforms support concurrency, add option do disable it
    50 libsrc += concurrency/CtxSwitch-@ARCHITECTURE@.S concurrency/alarm.cfa concurrency/invoke.c concurrency/preemption.cfa
     46thread_headers_nosrc = concurrency/invoke.h
     47thread_headers = concurrency/coroutine.hfa concurrency/thread.hfa concurrency/kernel.hfa concurrency/monitor.hfa concurrency/mutex.hfa
     48thread_libsrc = concurrency/CtxSwitch-@ARCHITECTURE@.S concurrency/alarm.cfa concurrency/invoke.c concurrency/preemption.cfa ${thread_headers:.hfa=.cfa}
    5149else
    5250headers =
     51thread_headers =
    5352headers_nosrc =
     53thread_headers_nosrc =
    5454libsrc =
    5555endif
     
    6464$(libobjs) : @CFACC@ @CFACPP@ prelude.cfa
    6565
     66thread_libobjs = $(addsuffix .lo, $(basename $(filter %.cfa,$(thread_libsrc))))
     67$(thread_libobjs) : @CFACC@ @CFACPP@ prelude.cfa
     68
    6669
    6770# .deps inclusion is not done automatically by automake for new languages
     
    7275
    7376-include $(libdeps)
     77
     78thread_libdeps = $(join \
     79        $(addsuffix $(DEPDIR)/ , $(dir $(thread_libobjs) ) ), \
     80        $(notdir ${thread_libobjs:.lo=.Plo}) \
     81)
     82
     83-include $(thread_libdeps)
     84
    7485
    7586prelude.o : prelude.cfa extras.cf gcc-builtins.cf builtins.cf @CFACC@ @CFACPP@
     
    8596libcfa_la_LDFLAGS = -version-info @CFA_VERSION@
    8697
     98libcfathread_la_SOURCES = ${thread_libsrc}
     99libcfathread_la_LDFLAGS = -version-info @CFA_VERSION@
     100
    87101stdhdr = $(shell find $(srcdir)/stdhdr -type f -printf "%p ")
    88102
    89103cfa_includedir = $(CFA_INCDIR)
    90 nobase_cfa_include_HEADERS = ${stdhdr} ${headers} ${headers_nosrc}
     104nobase_cfa_include_HEADERS = ${stdhdr} ${headers} ${headers_nosrc} ${thread_headers} ${thread_headers_nosrc}
    91105
    92106#----------------------------------------------------------------------------------------------------------------
  • libcfa/src/Makefile.in

    re723100 r884f140  
    142142        time.cfa stdlib.cfa common.cfa containers/maybe.cfa \
    143143        containers/pair.cfa containers/result.cfa \
    144         containers/vector.cfa concurrency/coroutine.cfa \
    145         concurrency/thread.cfa concurrency/kernel.cfa \
    146         concurrency/monitor.cfa concurrency/mutex.cfa \
    147         concurrency/CtxSwitch-@ARCHITECTURE@.S concurrency/alarm.cfa \
    148         concurrency/invoke.c concurrency/preemption.cfa
     144        containers/vector.cfa
    149145am__dirstamp = $(am__leading_dot)dirstamp
    150146@BUILDLIB_TRUE@am__objects_1 = fstream.lo iostream.lo iterator.lo \
     
    152148@BUILDLIB_TRUE@ common.lo containers/maybe.lo \
    153149@BUILDLIB_TRUE@ containers/pair.lo containers/result.lo \
    154 @BUILDLIB_TRUE@ containers/vector.lo concurrency/coroutine.lo \
    155 @BUILDLIB_TRUE@ concurrency/thread.lo concurrency/kernel.lo \
    156 @BUILDLIB_TRUE@ concurrency/monitor.lo concurrency/mutex.lo
     150@BUILDLIB_TRUE@ containers/vector.lo
    157151@BUILDLIB_TRUE@am__objects_2 = startup.lo interpose.lo bits/debug.lo \
    158152@BUILDLIB_TRUE@ assert.lo exception.lo virtual.lo heap.lo \
    159 @BUILDLIB_TRUE@ $(am__objects_1) \
    160 @BUILDLIB_TRUE@ concurrency/CtxSwitch-@ARCHITECTURE@.lo \
    161 @BUILDLIB_TRUE@ concurrency/alarm.lo concurrency/invoke.lo \
    162 @BUILDLIB_TRUE@ concurrency/preemption.lo
     153@BUILDLIB_TRUE@ $(am__objects_1)
    163154am_libcfa_la_OBJECTS = prelude.lo $(am__objects_2)
    164155libcfa_la_OBJECTS = $(am_libcfa_la_OBJECTS)
     
    170161        $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
    171162        $(libcfa_la_LDFLAGS) $(LDFLAGS) -o $@
     163libcfathread_la_LIBADD =
     164am__libcfathread_la_SOURCES_DIST =  \
     165        concurrency/CtxSwitch-@ARCHITECTURE@.S concurrency/alarm.cfa \
     166        concurrency/invoke.c concurrency/preemption.cfa \
     167        concurrency/coroutine.cfa concurrency/thread.cfa \
     168        concurrency/kernel.cfa concurrency/monitor.cfa \
     169        concurrency/mutex.cfa
     170@BUILDLIB_TRUE@am__objects_3 = concurrency/coroutine.lo \
     171@BUILDLIB_TRUE@ concurrency/thread.lo concurrency/kernel.lo \
     172@BUILDLIB_TRUE@ concurrency/monitor.lo concurrency/mutex.lo
     173@BUILDLIB_TRUE@am__objects_4 =  \
     174@BUILDLIB_TRUE@ concurrency/CtxSwitch-@ARCHITECTURE@.lo \
     175@BUILDLIB_TRUE@ concurrency/alarm.lo concurrency/invoke.lo \
     176@BUILDLIB_TRUE@ concurrency/preemption.lo $(am__objects_3)
     177am_libcfathread_la_OBJECTS = $(am__objects_4)
     178libcfathread_la_OBJECTS = $(am_libcfathread_la_OBJECTS)
     179libcfathread_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
     180        $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
     181        $(AM_CFLAGS) $(CFLAGS) $(libcfathread_la_LDFLAGS) $(LDFLAGS) \
     182        -o $@
    172183AM_V_P = $(am__v_P_@AM_V@)
    173184am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
     
    214225am__v_CCLD_0 = @echo "  CCLD    " $@;
    215226am__v_CCLD_1 =
    216 SOURCES = $(libcfa_la_SOURCES)
    217 DIST_SOURCES = $(am__libcfa_la_SOURCES_DIST)
     227SOURCES = $(libcfa_la_SOURCES) $(libcfathread_la_SOURCES)
     228DIST_SOURCES = $(am__libcfa_la_SOURCES_DIST) \
     229        $(am__libcfathread_la_SOURCES_DIST)
    218230am__can_run_installinfo = \
    219231  case $$AM_UPDATE_INFO_DIR in \
     
    225237        limits.hfa rational.hfa time.hfa stdlib.hfa common.hfa \
    226238        containers/maybe.hfa containers/pair.hfa containers/result.hfa \
    227         containers/vector.hfa concurrency/coroutine.hfa \
     239        containers/vector.hfa math.hfa gmp.hfa time_t.hfa \
     240        bits/align.hfa bits/containers.hfa bits/defs.hfa \
     241        bits/debug.hfa bits/locks.hfa concurrency/coroutine.hfa \
    228242        concurrency/thread.hfa concurrency/kernel.hfa \
    229         concurrency/monitor.hfa concurrency/mutex.hfa math.hfa gmp.hfa \
    230         time_t.hfa bits/align.hfa bits/containers.hfa bits/defs.hfa \
    231         bits/debug.hfa bits/locks.hfa concurrency/invoke.h
     243        concurrency/monitor.hfa concurrency/mutex.hfa \
     244        concurrency/invoke.h
    232245HEADERS = $(nobase_cfa_include_HEADERS)
    233246am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
     
    421434am__v_UPP_0 = @echo "  UPP     " $@;
    422435am__v_UPP_1 =
    423 lib_LTLIBRARIES = libcfa.la
     436lib_LTLIBRARIES = libcfa.la libcfathread.la
    424437
    425438# AM_CFLAGS for all cfa source
     
    433446
    434447#----------------------------------------------------------------------------------------------------------------
     448@BUILDLIB_TRUE@headers_nosrc = math.hfa gmp.hfa time_t.hfa bits/align.hfa bits/containers.hfa bits/defs.hfa bits/debug.hfa bits/locks.hfa
     449@BUILDLIB_FALSE@headers =
     450@BUILDLIB_TRUE@headers = fstream.hfa iostream.hfa iterator.hfa limits.hfa rational.hfa time.hfa stdlib.hfa common.hfa \
     451@BUILDLIB_TRUE@   containers/maybe.hfa containers/pair.hfa containers/result.hfa containers/vector.hfa
     452
     453@BUILDLIB_FALSE@libsrc =
     454@BUILDLIB_TRUE@libsrc = startup.cfa interpose.cfa bits/debug.cfa assert.cfa exception.c virtual.c heap.cfa ${headers:.hfa=.cfa}
     455@BUILDLIB_FALSE@thread_headers_nosrc =
    435456
    436457# not all platforms support concurrency, add option do disable it
    437 @BUILDLIB_TRUE@headers_nosrc = math.hfa gmp.hfa time_t.hfa \
    438 @BUILDLIB_TRUE@ bits/align.hfa bits/containers.hfa \
    439 @BUILDLIB_TRUE@ bits/defs.hfa bits/debug.hfa bits/locks.hfa \
    440 @BUILDLIB_TRUE@ concurrency/invoke.h
    441 @BUILDLIB_FALSE@headers =
    442 @BUILDLIB_TRUE@headers = fstream.hfa iostream.hfa iterator.hfa \
    443 @BUILDLIB_TRUE@ limits.hfa rational.hfa time.hfa stdlib.hfa \
    444 @BUILDLIB_TRUE@ common.hfa containers/maybe.hfa \
    445 @BUILDLIB_TRUE@ containers/pair.hfa containers/result.hfa \
    446 @BUILDLIB_TRUE@ containers/vector.hfa concurrency/coroutine.hfa \
    447 @BUILDLIB_TRUE@ concurrency/thread.hfa concurrency/kernel.hfa \
    448 @BUILDLIB_TRUE@ concurrency/monitor.hfa concurrency/mutex.hfa
    449 @BUILDLIB_FALSE@libsrc =
    450 
    451 # not all platforms support concurrency, add option do disable it
    452 @BUILDLIB_TRUE@libsrc = startup.cfa interpose.cfa bits/debug.cfa \
    453 @BUILDLIB_TRUE@ assert.cfa exception.c virtual.c heap.cfa \
    454 @BUILDLIB_TRUE@ ${headers:.hfa=.cfa} \
    455 @BUILDLIB_TRUE@ concurrency/CtxSwitch-@ARCHITECTURE@.S \
    456 @BUILDLIB_TRUE@ concurrency/alarm.cfa concurrency/invoke.c \
    457 @BUILDLIB_TRUE@ concurrency/preemption.cfa
     458@BUILDLIB_TRUE@thread_headers_nosrc = concurrency/invoke.h
     459@BUILDLIB_FALSE@thread_headers =
     460@BUILDLIB_TRUE@thread_headers = concurrency/coroutine.hfa concurrency/thread.hfa concurrency/kernel.hfa concurrency/monitor.hfa concurrency/mutex.hfa
     461@BUILDLIB_TRUE@thread_libsrc = concurrency/CtxSwitch-@ARCHITECTURE@.S concurrency/alarm.cfa concurrency/invoke.c concurrency/preemption.cfa ${thread_headers:.hfa=.cfa}
    458462
    459463#----------------------------------------------------------------------------------------------------------------
     
    463467# add dependency of cfa files
    464468libobjs = $(addsuffix .lo, $(basename $(filter %.cfa,$(libsrc))))
     469thread_libobjs = $(addsuffix .lo, $(basename $(filter %.cfa,$(thread_libsrc))))
    465470
    466471# .deps inclusion is not done automatically by automake for new languages
     
    470475)
    471476
     477thread_libdeps = $(join \
     478        $(addsuffix $(DEPDIR)/ , $(dir $(thread_libobjs) ) ), \
     479        $(notdir ${thread_libobjs:.lo=.Plo}) \
     480)
     481
    472482
    473483#----------------------------------------------------------------------------------------------------------------
    474484libcfa_la_SOURCES = prelude.cfa ${libsrc}
    475485libcfa_la_LDFLAGS = -version-info @CFA_VERSION@
     486libcfathread_la_SOURCES = ${thread_libsrc}
     487libcfathread_la_LDFLAGS = -version-info @CFA_VERSION@
    476488stdhdr = $(shell find $(srcdir)/stdhdr -type f -printf "%p ")
    477489cfa_includedir = $(CFA_INCDIR)
    478 nobase_cfa_include_HEADERS = ${stdhdr} ${headers} ${headers_nosrc}
     490nobase_cfa_include_HEADERS = ${stdhdr} ${headers} ${headers_nosrc} ${thread_headers} ${thread_headers_nosrc}
    479491all: all-am
    480492
     
    567579containers/vector.lo: containers/$(am__dirstamp) \
    568580        containers/$(DEPDIR)/$(am__dirstamp)
     581
     582libcfa.la: $(libcfa_la_OBJECTS) $(libcfa_la_DEPENDENCIES) $(EXTRA_libcfa_la_DEPENDENCIES)
     583        $(AM_V_CCLD)$(libcfa_la_LINK) -rpath $(libdir) $(libcfa_la_OBJECTS) $(libcfa_la_LIBADD) $(LIBS)
    569584concurrency/$(am__dirstamp):
    570585        @$(MKDIR_P) concurrency
     
    573588        @$(MKDIR_P) concurrency/$(DEPDIR)
    574589        @: > concurrency/$(DEPDIR)/$(am__dirstamp)
     590concurrency/CtxSwitch-@ARCHITECTURE@.lo: concurrency/$(am__dirstamp) \
     591        concurrency/$(DEPDIR)/$(am__dirstamp)
     592concurrency/alarm.lo: concurrency/$(am__dirstamp) \
     593        concurrency/$(DEPDIR)/$(am__dirstamp)
     594concurrency/invoke.lo: concurrency/$(am__dirstamp) \
     595        concurrency/$(DEPDIR)/$(am__dirstamp)
     596concurrency/preemption.lo: concurrency/$(am__dirstamp) \
     597        concurrency/$(DEPDIR)/$(am__dirstamp)
    575598concurrency/coroutine.lo: concurrency/$(am__dirstamp) \
    576599        concurrency/$(DEPDIR)/$(am__dirstamp)
     
    583606concurrency/mutex.lo: concurrency/$(am__dirstamp) \
    584607        concurrency/$(DEPDIR)/$(am__dirstamp)
    585 concurrency/CtxSwitch-@ARCHITECTURE@.lo: concurrency/$(am__dirstamp) \
    586         concurrency/$(DEPDIR)/$(am__dirstamp)
    587 concurrency/alarm.lo: concurrency/$(am__dirstamp) \
    588         concurrency/$(DEPDIR)/$(am__dirstamp)
    589 concurrency/invoke.lo: concurrency/$(am__dirstamp) \
    590         concurrency/$(DEPDIR)/$(am__dirstamp)
    591 concurrency/preemption.lo: concurrency/$(am__dirstamp) \
    592         concurrency/$(DEPDIR)/$(am__dirstamp)
    593 
    594 libcfa.la: $(libcfa_la_OBJECTS) $(libcfa_la_DEPENDENCIES) $(EXTRA_libcfa_la_DEPENDENCIES)
    595         $(AM_V_CCLD)$(libcfa_la_LINK) -rpath $(libdir) $(libcfa_la_OBJECTS) $(libcfa_la_LIBADD) $(LIBS)
     608
     609libcfathread.la: $(libcfathread_la_OBJECTS) $(libcfathread_la_DEPENDENCIES) $(EXTRA_libcfathread_la_DEPENDENCIES)
     610        $(AM_V_CCLD)$(libcfathread_la_LINK) -rpath $(libdir) $(libcfathread_la_OBJECTS) $(libcfathread_la_LIBADD) $(LIBS)
    596611
    597612mostlyclean-compile:
     
    922937        $(am__mv) $$depbase.Tpo $$depbase.Plo
    923938$(libobjs) : @CFACC@ @CFACPP@ prelude.cfa
     939$(thread_libobjs) : @CFACC@ @CFACPP@ prelude.cfa
    924940
    925941-include $(libdeps)
     942
     943-include $(thread_libdeps)
    926944
    927945prelude.o : prelude.cfa extras.cf gcc-builtins.cf builtins.cf @CFACC@ @CFACPP@
  • libcfa/src/bits/defs.hfa

    re723100 r884f140  
    4141}
    4242#endif
     43
     44#if defined(__cforall_thread__)
     45#define OPTIONAL_THREAD
     46#else
     47#define OPTIONAL_THREAD __attribute__((weak))
     48#endif
  • libcfa/src/bits/locks.hfa

    re723100 r884f140  
    5050#ifdef __cforall
    5151        extern "C" {
    52                 extern void disable_interrupts();
    53                 extern void enable_interrupts_noPoll();
     52                extern void disable_interrupts() OPTIONAL_THREAD;
     53                extern void enable_interrupts_noPoll() OPTIONAL_THREAD;
    5454
    5555                #ifdef __CFA_DEBUG__
  • libcfa/src/concurrency/alarm.cfa

    re723100 r884f140  
    1313// Update Count     : 67
    1414//
     15
     16#define __cforall_thread__
    1517
    1618extern "C" {
  • libcfa/src/concurrency/coroutine.cfa

    re723100 r884f140  
    1313// Update Count     : 9
    1414//
     15
     16#define __cforall_thread__
    1517
    1618#include "coroutine.hfa"
  • libcfa/src/concurrency/invoke.c

    re723100 r884f140  
    1313// Update Count     : 5
    1414//
     15
     16#define __cforall_thread__
    1517
    1618#include <stdbool.h>
     
    3133extern void __finish_creation( struct thread_desc * );
    3234extern void __leave_thread_monitor( struct thread_desc * this );
    33 extern void disable_interrupts();
     35extern void disable_interrupts() OPTIONAL_THREAD;
    3436extern void enable_interrupts( __cfaabi_dbg_ctx_param );
    3537
  • libcfa/src/concurrency/kernel.cfa

    re723100 r884f140  
    1313// Update Count     : 25
    1414//
     15
     16#define __cforall_thread__
    1517
    1618//C Includes
     
    943945        }
    944946)
     947
     948//-----------------------------------------------------------------------------
     949// Debug
     950bool threading_enabled(void) {
     951        return true;
     952}
    945953// Local Variables: //
    946954// mode: c //
  • libcfa/src/concurrency/kernel_private.hfa

    re723100 r884f140  
    2626
    2727extern "C" {
    28         void disable_interrupts();
     28        void disable_interrupts() OPTIONAL_THREAD;
    2929        void enable_interrupts_noPoll();
    3030        void enable_interrupts( __cfaabi_dbg_ctx_param );
  • libcfa/src/concurrency/monitor.cfa

    re723100 r884f140  
    1313// Update Count     : 9
    1414//
     15
     16#define __cforall_thread__
    1517
    1618#include "monitor.hfa"
  • libcfa/src/concurrency/mutex.cfa

    re723100 r884f140  
    1515// Update Count     : 0
    1616//
     17
     18#define __cforall_thread__
    1719
    1820#include "mutex.hfa"
  • libcfa/src/concurrency/preemption.cfa

    re723100 r884f140  
    1313// Update Count     : 37
    1414//
     15
     16#define __cforall_thread__
    1517
    1618#include "preemption.hfa"
  • libcfa/src/concurrency/thread.cfa

    re723100 r884f140  
    1313// Update Count     : 8
    1414//
     15
     16#define __cforall_thread__
    1517
    1618#include "thread.hfa"
  • libcfa/src/stdlib.cfa

    re723100 r884f140  
    252252long double _Complex random( void ) { return (long double)drand48() + (long double _Complex)(drand48() * _Complex_I); }
    253253
     254//---------------------------------------
     255
     256bool threading_enabled(void) __attribute__((weak)) {
     257        return false;
     258}
    254259
    255260// Local Variables: //
  • libcfa/src/stdlib.hfa

    re723100 r884f140  
    1515
    1616#pragma once
     17
     18#include "bits/defs.hfa"
    1719
    1820#include <stdlib.h>                                                                             // *alloc, strto*, ato*
     
    246248#include "common.hfa"
    247249
     250//---------------------------------------
     251
     252extern bool threading_enabled(void) OPTIONAL_THREAD;
     253
    248254// Local Variables: //
    249255// mode: c //
  • src/InitTweak/InitTweak.cc

    re723100 r884f140  
    99// Author           : Rob Schluntz
    1010// Created On       : Fri May 13 11:26:36 2016
    11 // Last Modified By : Aaron B. Moss
    12 // Last Modified On : Mon Jun 10 13:30:00 2019
    13 // Update Count     : 5
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Fri Jun 19 14:34:00 2019
     13// Update Count     : 6
    1414//
    1515
     
    633633                        return nullptr;
    634634                }
     635
     636                DeclarationWithType * getFunctionCore( const Expression * expr ) {
     637                        if ( const auto * appExpr = dynamic_cast< const ApplicationExpr * >( expr ) ) {
     638                                return getCalledFunction( appExpr->function );
     639                        } else if ( const auto * untyped = dynamic_cast< const UntypedExpr * >( expr ) ) {
     640                                return getCalledFunction( untyped->function );
     641                        }
     642                        assertf( false, "getFunction with unknown expression: %s", toString( expr ).c_str() );
     643                }
    635644        }
    636645
    637646        DeclarationWithType * getFunction( Expression * expr ) {
    638                 if ( ApplicationExpr * appExpr = dynamic_cast< ApplicationExpr * >( expr ) ) {
    639                         return getCalledFunction( appExpr->get_function() );
    640                 } else if ( UntypedExpr * untyped = dynamic_cast< UntypedExpr * > ( expr ) ) {
    641                         return getCalledFunction( untyped->get_function() );
    642                 }
    643                 assertf( false, "getFunction received unknown expression: %s", toString( expr ).c_str() );
     647                return getFunctionCore( expr );
     648        }
     649
     650        const DeclarationWithType * getFunction( const Expression * expr ) {
     651                return getFunctionCore( expr );
    644652        }
    645653
  • src/InitTweak/InitTweak.h

    re723100 r884f140  
    99// Author           : Rob Schluntz
    1010// Created On       : Fri May 13 11:26:36 2016
    11 // Last Modified By : Aaron B. Moss
    12 // Last Modified On : Mon Jun 10 13:30:00 2019
    13 // Update Count     : 5
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Fri Jul 19 14:18:00 2019
     13// Update Count     : 6
    1414//
    1515
     
    6161        /// returns the declaration of the function called by the expr (must be ApplicationExpr or UntypedExpr)
    6262        DeclarationWithType * getFunction( Expression * expr );
     63        const DeclarationWithType * getFunction( const Expression * expr );
    6364        const ast::DeclWithType * getFunction( const ast::Expr * expr );
    6465
  • src/ResolvExpr/FindOpenVars.cc

    re723100 r884f140  
    99// Author           : Richard C. Bilson
    1010// Created On       : Sun May 17 09:42:48 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun May 17 09:45:25 2015
    13 // Update Count     : 3
     11// Last Modified By : Andrew
     12// Last Modified On : Fri Jul 12 14:18:00 2019
     13// Update Count     : 4
    1414//
    1515
     
    2929                FindOpenVars_old( OpenVarSet &openVars, OpenVarSet &closedVars, AssertionSet &needAssertions, AssertionSet &haveAssertions, bool firstIsOpen );
    3030
    31                 void previsit( PointerType * pointerType );
    32                 void previsit( ArrayType * arrayType );
    33                 void previsit( FunctionType * functionType );
    34                 void previsit( TupleType * tupleType );
     31                void previsit( const PointerType * pointerType );
     32                void previsit( const ArrayType * arrayType );
     33                void previsit( const FunctionType * functionType );
     34                void previsit( const TupleType * tupleType );
    3535
    36                 void common_action( Type *type );
     36                void common_action( const Type *type );
    3737
    3838                OpenVarSet &openVars, &closedVars;
     
    4141        };
    4242
    43         void findOpenVars( Type *type, OpenVarSet &openVars, OpenVarSet &closedVars, AssertionSet &needAssertions, AssertionSet &haveAssertions, bool firstIsOpen ) {
     43        void findOpenVars( const Type *type, OpenVarSet &openVars, OpenVarSet &closedVars, AssertionSet &needAssertions, AssertionSet &haveAssertions, bool firstIsOpen ) {
    4444                PassVisitor<FindOpenVars_old> finder( openVars, closedVars, needAssertions, haveAssertions, firstIsOpen );
    4545                type->accept( finder );
     
    5050        }
    5151
    52         void FindOpenVars_old::common_action( Type *type ) {
     52        void FindOpenVars_old::common_action( const Type * type ) {
    5353                if ( nextIsOpen ) {
    54                         for ( Type::ForallList::const_iterator i = type->get_forall().begin(); i != type->get_forall().end(); ++i ) {
     54                        for ( Type::ForallList::const_iterator i = type->forall.begin(); i != type->forall.end(); ++i ) {
    5555                                openVars[ (*i)->get_name() ] = TypeDecl::Data{ (*i) };
    5656                                for ( std::list< DeclarationWithType* >::const_iterator assert = (*i)->get_assertions().begin(); assert != (*i)->get_assertions().end(); ++assert ) {
     
    6161                        }
    6262                } else {
    63                         for ( Type::ForallList::const_iterator i = type->get_forall().begin(); i != type->get_forall().end(); ++i ) {
     63                        for ( Type::ForallList::const_iterator i = type->forall.begin(); i != type->forall.end(); ++i ) {
    6464                                closedVars[ (*i)->get_name() ] = TypeDecl::Data{ (*i) };
    6565                                for ( std::list< DeclarationWithType* >::const_iterator assert = (*i)->get_assertions().begin(); assert != (*i)->get_assertions().end(); ++assert ) {
     
    7878        }
    7979
    80         void FindOpenVars_old::previsit(PointerType *pointerType) {
     80        void FindOpenVars_old::previsit(const PointerType * pointerType) {
    8181                common_action( pointerType );
    8282        }
    8383
    84         void FindOpenVars_old::previsit(ArrayType *arrayType) {
     84        void FindOpenVars_old::previsit(const ArrayType * arrayType) {
    8585                common_action( arrayType );
    8686        }
    8787
    88         void FindOpenVars_old::previsit(FunctionType *functionType) {
     88        void FindOpenVars_old::previsit(const FunctionType * functionType) {
    8989                common_action( functionType );
    9090                nextIsOpen = ! nextIsOpen;
     
    9292        }
    9393
    94         void FindOpenVars_old::previsit(TupleType *tupleType) {
     94        void FindOpenVars_old::previsit(const TupleType * tupleType) {
    9595                common_action( tupleType );
    9696        }
     
    104104                        bool nextIsOpen;
    105105
    106                         FindOpenVars_new( 
    107                                 ast::OpenVarSet & o, ast::OpenVarSet & c, ast::AssertionSet & n, 
     106                        FindOpenVars_new(
     107                                ast::OpenVarSet & o, ast::OpenVarSet & c, ast::AssertionSet & n,
    108108                                ast::AssertionSet & h, FirstMode firstIsOpen )
    109109                        : open( o ), closed( c ), need( n ), have( h ), nextIsOpen( firstIsOpen ) {}
     
    135135        }
    136136
    137         void findOpenVars( 
    138                         const ast::Type * type, ast::OpenVarSet & open, ast::OpenVarSet & closed, 
     137        void findOpenVars(
     138                        const ast::Type * type, ast::OpenVarSet & open, ast::OpenVarSet & closed,
    139139                        ast::AssertionSet & need, ast::AssertionSet & have, FirstMode firstIsOpen ) {
    140140                ast::Pass< FindOpenVars_new > finder{ open, closed, need, have, firstIsOpen };
  • src/ResolvExpr/FindOpenVars.h

    re723100 r884f140  
    2626namespace ResolvExpr {
    2727        // Updates open and closed variables and their associated assertions
    28         void findOpenVars( Type *type, OpenVarSet &openVars, OpenVarSet &closedVars, AssertionSet &needAssertions, AssertionSet &haveAssertions, bool firstIsOpen );
     28        void findOpenVars( const Type *type, OpenVarSet &openVars, OpenVarSet &closedVars, AssertionSet &needAssertions, AssertionSet &haveAssertions, bool firstIsOpen );
    2929
    3030        enum FirstMode { FirstClosed, FirstOpen };
  • src/ResolvExpr/Occurs.cc

    re723100 r884f140  
    2424        struct Occurs : public WithVisitorRef<Occurs> {
    2525                Occurs( std::string varName, const TypeEnvironment &env );
    26                 void previsit( TypeInstType * typeInst );
     26                void previsit( const TypeInstType * typeInst );
    2727
    2828                bool result;
     
    3131        };
    3232
    33         bool occurs( Type *type, std::string varName, const TypeEnvironment &env ) {
     33        bool occurs( const Type *type, const std::string & varName, const TypeEnvironment &env ) {
    3434                PassVisitor<Occurs> occur( varName, env );
    3535                type->accept( occur );
     
    4545        }
    4646
    47         void Occurs::previsit( TypeInstType * typeInst ) {
     47        void Occurs::previsit( const TypeInstType * typeInst ) {
    4848                ///   std::cerr << "searching for vars: ";
    4949///   std::copy( eqvVars.begin(), eqvVars.end(), std::ostream_iterator< std::string >( std::cerr, " " ) );
  • src/ResolvExpr/ResolveAssertions.cc

    re723100 r884f140  
    7373                CandidateList matches;
    7474
    75                 DeferItem( DeclarationWithType* decl, const AssertionSetValue& info, CandidateList&& matches )
     75                DeferItem( const DeclarationWithType* decl, const AssertionSetValue& info, CandidateList&& matches )
    7676                : decl(decl), info(info), matches(std::move(matches)) {}
    7777
  • src/ResolvExpr/TypeEnvironment.cc

    re723100 r884f140  
    315315        }
    316316
    317         bool isFtype( Type *type ) {
    318                 if ( dynamic_cast< FunctionType* >( type ) ) {
     317        bool isFtype( const Type *type ) {
     318                if ( dynamic_cast< const FunctionType * >( type ) ) {
    319319                        return true;
    320                 } else if ( TypeInstType *typeInst = dynamic_cast< TypeInstType* >( type ) ) {
     320                } else if ( const TypeInstType *typeInst = dynamic_cast< const TypeInstType * >( type ) ) {
    321321                        return typeInst->get_isFtype();
    322322                } // if
  • src/ResolvExpr/typeops.h

    re723100 r884f140  
    149149
    150150        // in Occurs.cc
    151         bool occurs( Type * type, std::string varName, const TypeEnvironment & env );
     151        bool occurs( const Type * type, const std::string & varName, const TypeEnvironment & env );
    152152        // new AST version in TypeEnvironment.cpp (only place it was used in old AST)
    153153
     
    200200
    201201        // in TypeEnvironment.cc
    202         bool isFtype( Type * type );
     202        bool isFtype( const Type * type );
    203203} // namespace ResolvExpr
    204204
  • src/SynTree/Type.cc

    re723100 r884f140  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Jan 31 21:54:16 2019
    13 // Update Count     : 43
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Fri Jul 12 15:48:00 2019
     13// Update Count     : 44
    1414//
    1515#include "Type.h"
     
    141141}
    142142
     143const Type * Type::stripReferences() const {
     144        const Type * type;
     145        const ReferenceType * ref;
     146        for ( type = this; (ref = dynamic_cast<const ReferenceType *>( type )); type = ref->base );
     147        return type;
     148}
     149
    143150int Type::referenceDepth() const { return 0; }
    144151
  • src/SynTree/Type.h

    re723100 r884f140  
    172172        /// return type without outer references
    173173        Type * stripReferences();
     174        const Type * stripReferences() const;
    174175
    175176        /// return the number of references occuring consecutively on the outermost layer of this type (i.e. do not count references nested within other types)
     
    256257        BasicType( const Type::Qualifiers & tq, Kind bt, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
    257258
    258         Kind get_kind() { return kind; }
     259        Kind get_kind() const { return kind; }
    259260        void set_kind( Kind newValue ) { kind = newValue; }
    260261
  • src/Tuples/TupleExpansion.cc

    re723100 r884f140  
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Feb 13 18:14:12 2019
    13 // Update Count     : 21
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Fri Jul 19 14:39:00 2019
     13// Update Count     : 22
    1414//
    1515
     
    364364                        ImpurityDetector( bool ignoreUnique ) : ignoreUnique( ignoreUnique ) {}
    365365
    366                         void previsit( ApplicationExpr * appExpr ) {
     366                        void previsit( const ApplicationExpr * appExpr ) {
    367367                                visit_children = false;
    368                                 if ( DeclarationWithType * function = InitTweak::getFunction( appExpr ) ) {
    369                                         if ( function->get_linkage() == LinkageSpec::Intrinsic ) {
    370                                                 if ( function->get_name() == "*?" || function->get_name() == "?[?]" ) {
     368                                if ( const DeclarationWithType * function = InitTweak::getFunction( appExpr ) ) {
     369                                        if ( function->linkage == LinkageSpec::Intrinsic ) {
     370                                                if ( function->name == "*?" || function->name == "?[?]" ) {
    371371                                                        // intrinsic dereference, subscript are pure, but need to recursively look for impurity
    372372                                                        visit_children = true;
     
    377377                                maybeImpure = true;
    378378                        }
    379                         void previsit( UntypedExpr * ) { maybeImpure = true; visit_children = false; }
    380                         void previsit( UniqueExpr * ) {
     379                        void previsit( const UntypedExpr * ) { maybeImpure = true; visit_children = false; }
     380                        void previsit( const UniqueExpr * ) {
    381381                                if ( ignoreUnique ) {
    382382                                        // bottom out at unique expression.
     
    393393        } // namespace
    394394
    395         bool maybeImpure( Expression * expr ) {
     395        bool maybeImpure( const Expression * expr ) {
    396396                PassVisitor<ImpurityDetector> detector( false );
    397397                expr->accept( detector );
     
    399399        }
    400400
    401         bool maybeImpureIgnoreUnique( Expression * expr ) {
     401        bool maybeImpureIgnoreUnique( const Expression * expr ) {
    402402                PassVisitor<ImpurityDetector> detector( true );
    403403                expr->accept( detector );
  • src/Tuples/Tuples.h

    re723100 r884f140  
    5555
    5656        /// returns true if the expression may contain side-effects.
    57         bool maybeImpure( Expression * expr );
     57        bool maybeImpure( const Expression * expr );
    5858        bool maybeImpure( const ast::Expr * expr );
    5959
    6060        /// Returns true if the expression may contain side-effect,
    6161        /// ignoring the presence of unique expressions.
    62         bool maybeImpureIgnoreUnique( Expression * expr );
     62        bool maybeImpureIgnoreUnique( const Expression * expr );
    6363        bool maybeImpureIgnoreUnique( const ast::Expr * expr );
    6464} // namespace Tuples
Note: See TracChangeset for help on using the changeset viewer.