Changeset be8bd88 for src/CodeGen


Ignore:
Timestamp:
Mar 8, 2017, 3:22:50 PM (9 years ago)
Author:
Aaron Moss <a3moss@…>
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:
031a2c95, 0e7ea335
Parents:
87c3bef (diff), 6363ad1 (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

Location:
src/CodeGen
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/CodeGen/CodeGenerator.cc

    r87c3bef rbe8bd88  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb 16 14:56:29 2017
    13 // Update Count     : 418
     12// Last Modified On : Sun Mar  5 17:13:33 2017
     13// Update Count     : 475
    1414//
    1515
     
    134134
    135135                handleStorageClass( functionDecl );
    136                 if ( functionDecl->get_isInline() ) {
    137                         output << "inline ";
    138                 } // if
    139                 if ( functionDecl->get_isNoreturn() ) {
    140                         output << "_Noreturn ";
    141                 } // if
     136                DeclarationNode::print_FuncSpec( output, functionDecl->get_funcSpec() );
     137
    142138                output << genType( functionDecl->get_functionType(), mangleName( functionDecl ), pretty );
    143139
     
    835831        }
    836832
    837 
    838833        void CodeGenerator::visit( ReturnStmt * returnStmt ) {
    839834                output << "return ";
     
    899894        }
    900895
    901         void CodeGenerator::handleStorageClass( Declaration * decl ) {
    902                 switch ( decl->get_storageClass() ) {
    903                   case DeclarationNode::Extern:
    904                         output << "extern ";
    905                         break;
    906                   case DeclarationNode::Static:
    907                         output << "static ";
    908                         break;
    909                   case DeclarationNode::Auto:
    910                         // silently drop storage class
    911                         break;
    912                   case DeclarationNode::Register:
    913                         output << "register ";
    914                         break;
    915                   case DeclarationNode::Inline:
    916                         output << "inline ";
    917                         break;
    918                   case DeclarationNode::Fortran:
    919                         output << "fortran ";
    920                         break;
    921                   case DeclarationNode::Noreturn:
    922                         output << "_Noreturn ";
    923                         break;
    924                   case DeclarationNode::Threadlocal:
    925                         output << "_Thread_local ";
    926                         break;
    927                   case DeclarationNode::NoStorageClass:
    928                         break;
    929                 } // switch
    930         }
     896        void CodeGenerator::handleStorageClass( DeclarationWithType * decl ) {
     897                if ( decl->get_storageClasses().any() ) {
     898                        DeclarationNode::print_StorageClass( output, decl->get_storageClasses() );
     899                } // if
     900        } // CodeGenerator::handleStorageClass
    931901
    932902        std::string genName( DeclarationWithType * decl ) {
  • src/CodeGen/CodeGenerator.h

    r87c3bef rbe8bd88  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb  9 15:06:21 2017
    13 // Update Count     : 49
     12// Last Modified On : Wed Mar  1 16:20:04 2017
     13// Update Count     : 50
    1414//
    1515
     
    123123
    124124                void printDesignators( std::list< Expression * > & );
    125                 void handleStorageClass( Declaration *decl );
     125                void handleStorageClass( DeclarationWithType *decl );
    126126                void handleAggregate( AggregateDecl *aggDecl );
    127127                void handleTypedef( NamedTypeDecl *namedType );
  • src/CodeGen/FixNames.cc

    r87c3bef rbe8bd88  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Rob Schluntz
    12 // Last Modified On : Mon Apr 11 15:38:10 2016
    13 // Update Count     : 1
     11// Last Modified By : Peter A. Buhr
     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, false, false
    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
    52                 auto&& name = SymTab::Mangler::mangle( mainDecl.get() );
     48                auto && name = SymTab::Mangler::mangle( mainDecl.get() );
    5349                // std::cerr << name << std::endl;
    5450                return name;
     
    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, false, false
    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.