Changeset fa4805f


Ignore:
Timestamp:
Jun 28, 2017, 4:05:46 PM (7 years ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
a67b60e
Parents:
16c95e3
Message:

The builtins.cf now includes exception handling functions.

Location:
src
Files:
2 added
14 edited

Legend:

Unmodified
Added
Removed
  • src/CodeGen/FixNames.cc

    r16c95e3 rfa4805f  
    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 : Wed Jun 21 14:22:59 2017
    13 // Update Count     : 19
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Wed Jun 28 15:26:00 2017
     13// Update Count     : 20
    1414//
    1515
     
    9393        void FixNames::fixDWT( DeclarationWithType *dwt ) {
    9494                if ( dwt->get_name() != "" ) {
    95                         if ( LinkageSpec::isDecoratable( dwt->get_linkage() ) ) {
     95                        if ( LinkageSpec::isMangled( dwt->get_linkage() ) ) {
    9696                                dwt->set_mangleName( SymTab::Mangler::mangle( dwt ) );
    9797                                dwt->set_scopeLevel( scopeLevel );
  • src/Parser/DeclarationNode.cc

    r16c95e3 rfa4805f  
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Sat May 16 12:34:05 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Mar 17 15:46:33 2017
    13 // Update Count     : 1018
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Wed Jun 28 15:27:00 2017
     13// Update Count     : 1019
    1414//
    1515
     
    10631063          case TypeData::Enum:
    10641064          case TypeData::Aggregate: {
    1065                   ReferenceToType * ret = buildComAggInst( type, attributes );
     1065                  ReferenceToType * ret = buildComAggInst( type, attributes, linkage );
    10661066                  buildList( type->aggregate.actuals, ret->get_parameters() );
    10671067                  return ret;
  • src/Parser/LinkageSpec.cc

    r16c95e3 rfa4805f  
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Sat May 16 13:22:09 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Oct  2 23:16:21 2016
    13 // Update Count     : 23
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Wed Jun 28 11:51:00 2017
     13// Update Count     : 24
    1414//
    1515
     
    2828        } else if ( *spec == "\"C\"" ) {
    2929                return C;
     30        } else if ( *spec == "\"BuiltinC\"" ) {
     31                return BuiltinC;
    3032        } else {
    3133                throw SemanticError( "Invalid linkage specifier " + *spec );
     
    3638        assert( 0 <= linkage && linkage < LinkageSpec::NoOfSpecs );
    3739        static const char *linkageKinds[LinkageSpec::NoOfSpecs] = {
    38                 "intrinsic", "Cforall", "C", "automatically generated", "compiler built-in",
     40                "intrinsic", "Cforall", "C", "automatically generated", "compiler built-in", "cfa built-in", "c built-in",
    3941        };
    4042        return linkageKinds[linkage];
    4143}
    4244
    43 bool LinkageSpec::isDecoratable( Spec spec ) {
     45bool LinkageSpec::isMangled( Spec spec ) {
    4446        assert( 0 <= spec && spec < LinkageSpec::NoOfSpecs );
    4547        static bool decoratable[LinkageSpec::NoOfSpecs] = {
    46                 //      Intrinsic,      Cforall,        C,              AutoGen,        Compiler
     48                //      Intrinsic,      Cforall,        C,              AutoGen,        Compiler,
    4749                        true,           true,           false,  true,           false,
     50                //      Builtin,        BuiltinC,
     51                        true,           false,
    4852        };
    4953        return decoratable[spec];
     
    5357        assert( 0 <= spec && spec < LinkageSpec::NoOfSpecs );
    5458        static bool generatable[LinkageSpec::NoOfSpecs] = {
    55                 //      Intrinsic,      Cforall,        C,              AutoGen,        Compiler
     59                //      Intrinsic,      Cforall,        C,              AutoGen,        Compiler,
    5660                        true,           true,           true,   true,           false,
     61                //      Builtin,        BuiltinC,
     62                        true,           true,
    5763        };
    5864        return generatable[spec];
     
    6268        assert( spec >= 0 && spec < LinkageSpec::NoOfSpecs );
    6369        static bool overridable[LinkageSpec::NoOfSpecs] = {
    64                 //      Intrinsic,      Cforall,        C,              AutoGen,        Compiler
     70                //      Intrinsic,      Cforall,        C,              AutoGen,        Compiler,
    6571                        true,           false,          false,  true,           false,
     72                //      Builtin,        BuiltinC,
     73                        false,          false,
    6674        };
    6775        return overridable[spec];
     
    7179        assert( spec >= 0 && spec < LinkageSpec::NoOfSpecs );
    7280        static bool builtin[LinkageSpec::NoOfSpecs] = {
    73                 //      Intrinsic,      Cforall,        C,              AutoGen,        Compiler
     81                //      Intrinsic,      Cforall,        C,              AutoGen,        Compiler,
    7482                        true,           false,          false,  false,          true,
     83                //      Builtin,        BuiltinC,
     84                        true,           true,
    7585        };
    7686        return builtin[spec];
  • src/Parser/LinkageSpec.h

    r16c95e3 rfa4805f  
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Sat May 16 13:24:28 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Oct  1 23:03:17 2016
    13 // Update Count     : 11
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Wed Jun 28 11:50:00 2017
     13// Update Count     : 12
    1414//
    1515
     
    2626                AutoGen,                                                                                // built by translator (struct assignment)
    2727                Compiler,                                                                               // gcc internal
     28                Builtin,                                                                                // mangled builtins
     29                BuiltinC,                                                                               // non-mangled builtins
    2830                NoOfSpecs
    2931        };
     
    3234        static std::string linkageName( Spec );
    3335 
    34         static bool isDecoratable( Spec );
     36        static bool isMangled( Spec );
    3537        static bool isGeneratable( Spec );
    3638        static bool isOverridable( Spec );
  • src/Parser/TypeData.cc

    r16c95e3 rfa4805f  
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Sat May 16 15:12:51 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Mar 17 15:52:43 2017
    13 // Update Count     : 563
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Wed Jun 28 15:28:00 2017
     13// Update Count     : 564
    1414//
    1515
     
    614614} // buildPointer
    615615
    616 AggregateDecl * buildAggregate( const TypeData * td, std::list< Attribute * > attributes ) {
     616AggregateDecl * buildAggregate( const TypeData * td, std::list< Attribute * > attributes, LinkageSpec::Spec linkage ) {
    617617        assert( td->kind == TypeData::Aggregate );
    618618        AggregateDecl * at;
     
    622622          case DeclarationNode::Monitor:
    623623          case DeclarationNode::Thread:
    624                 at = new StructDecl( *td->aggregate.name, td->aggregate.kind, attributes );
     624                at = new StructDecl( *td->aggregate.name, td->aggregate.kind, attributes, linkage );
    625625                buildForall( td->aggregate.params, at->get_parameters() );
    626626                break;
     
    643643} // buildAggregate
    644644
    645 ReferenceToType * buildComAggInst( const TypeData * type, std::list< Attribute * > attributes ) {
     645ReferenceToType * buildComAggInst( const TypeData * type, std::list< Attribute * > attributes, LinkageSpec::Spec linkage ) {
    646646        switch ( type->kind ) {
    647647          case TypeData::Enum: {
     
    656656                  ReferenceToType * ret;
    657657                  if ( type->aggregate.body ) {
    658                           AggregateDecl * typedecl = buildAggregate( type, attributes );
     658                          AggregateDecl * typedecl = buildAggregate( type, attributes, linkage );
    659659                          switch ( type->aggregate.kind ) {
    660660                                case DeclarationNode::Struct:
     
    802802                return decl->set_asmName( asmName );
    803803        } else if ( td->kind == TypeData::Aggregate ) {
    804                 return buildAggregate( td, attributes );
     804                return buildAggregate( td, attributes, linkage );
    805805        } else if ( td->kind == TypeData::Enum ) {
    806806                return buildEnum( td, attributes );
  • src/Parser/TypeData.h

    r16c95e3 rfa4805f  
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Sat May 16 15:18:36 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Mar 16 08:32:39 2017
    13 // Update Count     : 185
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Wed Jun 28 15:29:00 2017
     13// Update Count     : 186
    1414//
    1515
     
    102102ArrayType * buildArray( const TypeData * );
    103103AggregateDecl * buildAggregate( const TypeData *, std::list< Attribute * > );
    104 ReferenceToType * buildComAggInst( const TypeData *, std::list< Attribute * > attributes );
     104ReferenceToType * buildComAggInst( const TypeData *, std::list< Attribute * > attributes, LinkageSpec::Spec linkage );
    105105ReferenceToType * buildAggInst( const TypeData * );
    106106TypeDecl * buildVariable( const TypeData * );
  • src/SymTab/Autogen.cc

    r16c95e3 rfa4805f  
    99// Author           : Rob Schluntz
    1010// Created On       : Thu Mar 03 15:45:56 2016
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Mar 17 09:41:08 2017
    13 // Update Count     : 60
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Wed Jun 28 15:30:00 2017
     13// Update Count     : 61
    1414//
    1515
     
    400400        /// generates struct constructors, destructor, and assignment functions
    401401        void makeStructFunctions( StructDecl *aggregateDecl, StructInstType *refType, unsigned int functionNesting, std::list< Declaration * > & declsToAdd, const std::vector< FuncData > & data ) {
     402                // Builtins do not use autogeneration.
     403                if ( aggregateDecl->get_linkage() == LinkageSpec::Builtin ||
     404                         aggregateDecl->get_linkage() == LinkageSpec::BuiltinC ) {
     405                        return;
     406                }
     407
    402408                // Make function polymorphic in same parameters as generic struct, if applicable
    403409                const std::list< TypeDecl* > & typeParams = aggregateDecl->get_parameters(); // List of type variables to be placed on the generated functions
  • src/SymTab/Mangler.cc

    r16c95e3 rfa4805f  
    99// Author           : Richard C. Bilson
    1010// Created On       : Sun May 17 21:40:29 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Mar 17 09:40:01 2017
    13 // Update Count     : 20
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Wed Jun 28 15:31:00 2017
     13// Update Count     : 21
    1414//
    1515
     
    7272                        } else {
    7373                                // if we add another kind of overridable function, this has to change
    74                                 assert( false );
     74                                assert( false && "unknown overrideable linkage" );
    7575                        } // if
    7676                }
  • src/SynTree/AggregateDecl.cc

    r16c95e3 rfa4805f  
    99// Author           : Richard C. Bilson
    1010// Created On       : Sun May 17 23:56:39 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Mar 16 07:49:07 2017
    13 // Update Count     : 20
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Tus Jun 27 15:30:00 2017
     13// Update Count     : 21
    1414//
    1515
     
    2020
    2121
    22 AggregateDecl::AggregateDecl( const std::string &name, const std::list< Attribute * > & attributes ) : Parent( name, Type::StorageClasses(), LinkageSpec::Cforall ), body( false ), attributes( attributes ) {
     22AggregateDecl::AggregateDecl( const std::string &name, const std::list< Attribute * > & attributes, LinkageSpec::Spec linkage ) : Parent( name, Type::StorageClasses(), linkage ), body( false ), attributes( attributes ) {
    2323}
    2424
  • src/SynTree/Declaration.h

    r16c95e3 rfa4805f  
    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 : Fri Mar 17 16:05:08 2017
    13 // Update Count     : 121
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Tus Jun 27 15:31:00 2017
     13// Update Count     : 122
    1414//
    1515
     
    238238        typedef Declaration Parent;
    239239  public:
    240         AggregateDecl( const std::string &name, const std::list< Attribute * > & attributes = std::list< class Attribute * >() );
     240        AggregateDecl( const std::string &name, const std::list< Attribute * > & attributes = std::list< class Attribute * >(), LinkageSpec::Spec linkage = LinkageSpec::Cforall );
    241241        AggregateDecl( const AggregateDecl &other );
    242242        virtual ~AggregateDecl();
     
    266266        typedef AggregateDecl Parent;
    267267  public:
    268         StructDecl( const std::string &name, DeclarationNode::Aggregate kind = DeclarationNode::Struct, const std::list< Attribute * > & attributes = std::list< class Attribute * >() ) : Parent( name, attributes ), kind( kind ) {}
     268        StructDecl( const std::string &name, DeclarationNode::Aggregate kind = DeclarationNode::Struct, const std::list< Attribute * > & attributes = std::list< class Attribute * >(), LinkageSpec::Spec linkage = LinkageSpec::Cforall ) : Parent( name, attributes, linkage ), kind( kind ) {}
    269269        StructDecl( const StructDecl &other ) : Parent( other ) {}
    270270
     
    284284        typedef AggregateDecl Parent;
    285285  public:
    286         UnionDecl( const std::string &name, const std::list< Attribute * > & attributes = std::list< class Attribute * >() ) : Parent( name, attributes ) {}
     286        UnionDecl( const std::string &name, const std::list< Attribute * > & attributes = std::list< class Attribute * >(), LinkageSpec::Spec linkage = LinkageSpec::Cforall ) : Parent( name, attributes, linkage ) {}
    287287        UnionDecl( const UnionDecl &other ) : Parent( other ) {}
    288288
     
    297297        typedef AggregateDecl Parent;
    298298  public:
    299         EnumDecl( const std::string &name, const std::list< Attribute * > & attributes = std::list< class Attribute * >() ) : Parent( name, attributes ) {}
     299        EnumDecl( const std::string &name, const std::list< Attribute * > & attributes = std::list< class Attribute * >(), LinkageSpec::Spec linkage = LinkageSpec::Cforall ) : Parent( name, attributes, linkage ) {}
    300300        EnumDecl( const EnumDecl &other ) : Parent( other ) {}
    301301
  • src/libcfa/Makefile.am

    r16c95e3 rfa4805f  
    1010## Author           : Peter A. Buhr
    1111## Created On       : Sun May 31 08:54:01 2015
    12 ## Last Modified By : Peter A. Buhr
    13 ## Last Modified On : Sun May 14 21:04:21 2017
    14 ## Update Count     : 214
     12## Last Modified By : Andrew Beach
     13## Last Modified On : Wed Jun 28 15:36:00 2017
     14## Update Count     : 215
    1515###############################################################################
    1616
     
    6464        ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -O2 ${EXTRA_FLAGS} -c -o $@ $<
    6565
     66libcfa_a-exception.o : exception.c
     67        ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -O2 ${EXTRA_FLAGS} -c -o $@ $<
     68
    6669concurrency/libcfa_d_a-invoke.o : concurrency/invoke.c
     70        ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -D__CFA_DEBUG__ -O0 ${EXTRA_FLAGS} -c -o $@ $<
     71
     72libcfa_d_a-exception.o : exception.c
    6773        ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -D__CFA_DEBUG__ -O0 ${EXTRA_FLAGS} -c -o $@ $<
    6874
  • src/libcfa/Makefile.in

    r16c95e3 rfa4805f  
    14281428        ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -O2 ${EXTRA_FLAGS} -c -o $@ $<
    14291429
     1430libcfa_a-exception.o : exception.c
     1431        ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -O2 ${EXTRA_FLAGS} -c -o $@ $<
     1432
    14301433concurrency/libcfa_d_a-invoke.o : concurrency/invoke.c
     1434        ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -D__CFA_DEBUG__ -O0 ${EXTRA_FLAGS} -c -o $@ $<
     1435
     1436libcfa_d_a-exception.o : exception.c
    14311437        ${AM_V_CC}@BACKEND_CC@ -DHAVE_CONFIG_H -I. -I../.. -D__CFA_DEBUG__ -O0 ${EXTRA_FLAGS} -c -o $@ $<
    14321438
  • src/main.cc

    r16c95e3 rfa4805f  
    1111// Created On       : Fri May 15 23:12:02 2015
    1212// Last Modified By : Andrew Beach
    13 // Last Modified On : Wed May 10 14:45:00 2017
    14 // Update Count     : 437
     13// Last Modified On : Wed Jun 28 15:34:00 2017
     14// Update Count     : 438
    1515//
    1616
     
    186186                if ( ! nopreludep ) {                                                   // include gcc builtins
    187187                        // -l is for initial build ONLY and builtins.cf is not in the lib directory so access it here.
    188                         // Read to cfa builtins, if not generating the cfa library
    189                         FILE * builtins = fopen( libcfap | treep ? "../prelude/builtins.cf" : CFA_LIBDIR "/builtins.cf", "r" );
    190                         assertf( builtins, "cannot open builtins.cf\n" );
    191                         parse( builtins, LinkageSpec::Compiler );
    192188
    193189                        // Read to gcc builtins, if not generating the cfa library
     
    206202                                assertf( prelude, "cannot open prelude.cf\n" );
    207203                                parse( prelude, LinkageSpec::Intrinsic );
     204
     205                                // Read to cfa builtins, if not generating the cfa library
     206                                FILE * builtins = fopen( libcfap | treep ? "../prelude/builtins.cf" : CFA_LIBDIR "/builtins.cf", "r" );
     207                                assertf( builtins, "cannot open builtins.cf\n" );
     208                                parse( builtins, LinkageSpec::Builtin );
    208209                        } // if
    209210                } // if
  • src/prelude/builtins.c

    r16c95e3 rfa4805f  
    11typedef unsigned long long __cfaabi_exception_type_t;
     2
     3#include "../libcfa/exception.h"
Note: See TracChangeset for help on using the changeset viewer.