Changeset a7c90d4 for src/CodeGen


Ignore:
Timestamp:
Mar 7, 2017, 8:33:43 AM (9 years ago)
Author:
Peter A. Buhr <pabuhr@…>
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:
64cb860, c3396e0
Parents:
7fe2498
Message:

change StorageClass to bitset, support _Thread_local as separate storage-class

Location:
src/CodeGen
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/CodeGen/CodeGenerator.cc

    r7fe2498 ra7c90d4  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Mar  3 21:18:47 2017
    13 // Update Count     : 465
     12// Last Modified On : Sun Mar  5 17:13:33 2017
     13// Update Count     : 475
    1414//
    1515
     
    895895
    896896        void CodeGenerator::handleStorageClass( DeclarationWithType * decl ) {
    897                 switch ( decl->get_storageClass() ) {
    898                         //output << DeclarationNode::storageClassNames[decl->get_storageClass()] << ' ';
    899                   case DeclarationNode::Extern:
    900                         output << "extern ";
    901                         break;
    902                   case DeclarationNode::Static:
    903                         output << "static ";
    904                         break;
    905                   case DeclarationNode::Auto:
    906                         // silently drop storage class
    907                         break;
    908                   case DeclarationNode::Register:
    909                         output << "register ";
    910                         break;
    911                   case DeclarationNode::Threadlocal:
    912                         output << "_Thread_local ";
    913                         break;
    914                   case DeclarationNode::NoStorageClass:
    915                         break;
    916                   default:
    917                         assert( false );
    918                 } // switch
     897                if ( decl->get_storageClasses().any() ) {
     898                        DeclarationNode::print_StorageClass( output, decl->get_storageClasses() );
     899                } // if
    919900        } // CodeGenerator::handleStorageClass
    920901
  • src/CodeGen/FixNames.cc

    r7fe2498 ra7c90d4  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Mar  3 21:52:17 2017
    13 // Update Count     : 6
     12// Last Modified On : Mon Mar  6 23:32:08 2017
     13// Update Count     : 15
    1414//
    1515
     
    3939        std::string mangle_main() {
    4040                FunctionType* main_type;
    41                 std::unique_ptr<FunctionDecl> mainDecl { new FunctionDecl(
    42                         "main",
    43                         DeclarationNode::NoStorageClass,
    44                         LinkageSpec::Cforall,
    45                         main_type = new FunctionType( Type::Qualifiers(), true ),
    46                         nullptr
    47                 ) };
     41                std::unique_ptr<FunctionDecl> mainDecl { new FunctionDecl( "main", DeclarationNode::StorageClasses(), LinkageSpec::Cforall,
     42                                                                                                                                   main_type = new FunctionType( Type::Qualifiers(), true ), nullptr )
     43                                };
    4844                main_type->get_returnVals().push_back(
    49                         new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), nullptr )
     45                        new ObjectDecl( "", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), nullptr )
    5046                );
    5147
     
    5652        std::string mangle_main_args() {
    5753                FunctionType* main_type;
    58                 std::unique_ptr<FunctionDecl> mainDecl { new FunctionDecl(
    59                         "main",
    60                         DeclarationNode::NoStorageClass,
    61                         LinkageSpec::Cforall,
    62                         main_type = new FunctionType( Type::Qualifiers(), false ),
    63                         nullptr
    64                 ) };
     54                std::unique_ptr<FunctionDecl> mainDecl { new FunctionDecl( "main", DeclarationNode::StorageClasses(), LinkageSpec::Cforall,
     55                                                                                                                                   main_type = new FunctionType( Type::Qualifiers(), false ), nullptr )
     56                                };
    6557                main_type->get_returnVals().push_back(
    66                         new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), nullptr )
     58                        new ObjectDecl( "", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), nullptr )
    6759                );
    6860
    6961                mainDecl->get_functionType()->get_parameters().push_back(
    70                         new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), nullptr )
     62                        new ObjectDecl( "", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), nullptr )
    7163                );
    7264
    7365                mainDecl->get_functionType()->get_parameters().push_back(
    74                         new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0,
     66                        new ObjectDecl( "", DeclarationNode::StorageClasses(), LinkageSpec::Cforall, 0,
    7567                        new PointerType( Type::Qualifiers(), new PointerType( Type::Qualifiers(), new BasicType( Type::Qualifiers(), BasicType::Char ) ) ),
    7668                        nullptr )
Note: See TracChangeset for help on using the changeset viewer.