Changeset f73f5f4


Ignore:
Timestamp:
Jul 12, 2017, 10:14:15 AM (4 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, resolv-new, with_gc
Children:
3268a58, 76f2bdcb
Parents:
f2b12406 (diff), 7812f1d1 (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
Files:
31 edited

Legend:

Unmodified
Added
Removed
  • src/CodeGen/CodeGenerator.cc

    rf2b12406 rf73f5f4  
    1414//
    1515
    16 #include <algorithm>
    17 #include <iostream>
    18 #include <cassert>
    19 #include <list>
    20 
    21 #include "Parser/ParseNode.h"
    22 
    23 #include "SynTree/Declaration.h"
    24 #include "SynTree/Expression.h"
    25 #include "SynTree/Initializer.h"
    26 #include "SynTree/Statement.h"
    27 #include "SynTree/Type.h"
    28 #include "SynTree/Attribute.h"
    29 
    30 #include "Common/utility.h"
    31 #include "Common/UnimplementedError.h"
     16#include <cassert>                   // for assert, assertf
     17#include <list>                      // for _List_iterator, list, list<>::it...
    3218
    3319#include "CodeGenerator.h"
    34 #include "OperatorTable.h"
    35 #include "GenType.h"
    36 
    37 #include "InitTweak/InitTweak.h"
     20#include "Common/SemanticError.h"    // for SemanticError
     21#include "Common/UniqueName.h"       // for UniqueName
     22#include "Common/utility.h"          // for CodeLocation, toString
     23#include "GenType.h"                 // for genType
     24#include "InitTweak/InitTweak.h"     // for getPointerBase
     25#include "OperatorTable.h"           // for OperatorInfo, operatorLookup
     26#include "Parser/LinkageSpec.h"      // for Spec, Intrinsic
     27#include "SynTree/Attribute.h"       // for Attribute
     28#include "SynTree/BaseSyntaxNode.h"  // for BaseSyntaxNode
     29#include "SynTree/Constant.h"        // for Constant
     30#include "SynTree/Declaration.h"     // for DeclarationWithType, TypeDecl
     31#include "SynTree/Expression.h"      // for Expression, UntypedExpr, Applica...
     32#include "SynTree/Initializer.h"     // for Initializer, ListInit, Designation
     33#include "SynTree/Label.h"           // for Label, operator<<
     34#include "SynTree/Statement.h"       // for Statement, AsmStmt, BranchStmt
     35#include "SynTree/Type.h"            // for Type, Type::StorageClasses, Func...
    3836
    3937using namespace std;
  • src/CodeGen/CodeGenerator.h

    rf2b12406 rf73f5f4  
    1717#define CODEGENV_H
    1818
    19 #include <list>
     19#include <list>                   // for list
     20#include <ostream>                // for ostream, operator<<
     21#include <string>                 // for string
    2022
    21 #include "SynTree/Declaration.h"
    22 #include "SynTree/SynTree.h"
    23 #include "SynTree/Visitor.h"
    24 
    25 #include "SymTab/Indexer.h"
    26 
    27 #include "Common/utility.h"
     23#include "SynTree/Declaration.h"  // for DeclarationWithType (ptr only), Fun...
     24#include "SynTree/Visitor.h"      // for Visitor
     25#include "SynTree/SynTree.h"      // for Visitor Nodes
    2826
    2927namespace CodeGen {
  • src/CodeGen/FixMain.cc

    rf2b12406 rf73f5f4  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // FixMain.cc -- 
     7// FixMain.cc --
    88//
    99// Author           : Thierry Delisle
    1010// Created On       : Thr Jan 12 14:11:09 2017
    11 // Last Modified By : 
    12 // Last Modified On : 
     11// Last Modified By :
     12// Last Modified On :
    1313// Update Count     : 0
    1414//
    1515
    1616
    17 #include "FixMain.h"   
     17#include "FixMain.h"
    1818
    19 #include <fstream>
    20 #include <iostream>
     19#include <cassert>                 // for assert, assertf
     20#include <fstream>                 // for operator<<, basic_ostream::operator<<
     21#include <list>                    // for list
     22#include <string>                  // for operator<<
    2123
    22 #include "Common/SemanticError.h"
    23 #include "SynTree/Declaration.h"
     24#include "Common/SemanticError.h"  // for SemanticError
     25#include "SynTree/Declaration.h"   // for FunctionDecl, operator<<
     26#include "SynTree/Type.h"          // for FunctionType
    2427
    2528namespace CodeGen {
    2629        bool FixMain::replace_main = false;
    2730        std::unique_ptr<FunctionDecl> FixMain::main_signature = nullptr;
    28        
    29         void FixMain::registerMain(FunctionDecl* functionDecl) 
     31
     32        void FixMain::registerMain(FunctionDecl* functionDecl)
    3033        {
    31                 if(main_signature) { 
    32                         throw SemanticError("Multiple definition of main routine\n", functionDecl); 
     34                if(main_signature) {
     35                        throw SemanticError("Multiple definition of main routine\n", functionDecl);
    3336                }
    3437                main_signature.reset( functionDecl->clone() );
  • src/CodeGen/FixNames.cc

    rf2b12406 rf73f5f4  
    1414//
    1515
    16 #include <memory>
     16#include "FixNames.h"
    1717
    18 #include "FixNames.h"
    19 #include "SynTree/Declaration.h"
    20 #include "SynTree/Expression.h"
    21 #include "SynTree/Visitor.h"
    22 #include "SymTab/Mangler.h"
    23 #include "OperatorTable.h"
    24 #include "FixMain.h"
     18#include <memory>                  // for unique_ptr
     19#include <string>                  // for string, operator!=, operator==
     20
     21#include "Common/SemanticError.h"  // for SemanticError
     22#include "FixMain.h"               // for FixMain
     23#include "Parser/LinkageSpec.h"    // for Cforall, isMangled
     24#include "SymTab/Mangler.h"        // for Mangler
     25#include "SynTree/Constant.h"      // for Constant
     26#include "SynTree/Declaration.h"   // for FunctionDecl, ObjectDecl, Declarat...
     27#include "SynTree/Expression.h"    // for ConstantExpr
     28#include "SynTree/Label.h"         // for Label, noLabels
     29#include "SynTree/Statement.h"     // for ReturnStmt, CompoundStmt
     30#include "SynTree/Type.h"          // for Type, BasicType, Type::Qualifiers
     31#include "SynTree/Visitor.h"       // for Visitor, acceptAll
    2532
    2633namespace CodeGen {
     
    4249                                                                                                                                   main_type = new FunctionType( Type::Qualifiers(), true ), nullptr )
    4350                                };
    44                 main_type->get_returnVals().push_back( 
     51                main_type->get_returnVals().push_back(
    4552                        new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), nullptr )
    4653                );
     
    5259        std::string mangle_main_args() {
    5360                FunctionType* main_type;
    54                 std::unique_ptr<FunctionDecl> mainDecl { new FunctionDecl( "main", Type::StorageClasses(), LinkageSpec::Cforall, 
     61                std::unique_ptr<FunctionDecl> mainDecl { new FunctionDecl( "main", Type::StorageClasses(), LinkageSpec::Cforall,
    5562                                                                                                                                   main_type = new FunctionType( Type::Qualifiers(), false ), nullptr )
    5663                                };
    57                 main_type->get_returnVals().push_back( 
     64                main_type->get_returnVals().push_back(
    5865                        new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), nullptr )
    5966                );
    6067
    61                 mainDecl->get_functionType()->get_parameters().push_back( 
     68                mainDecl->get_functionType()->get_parameters().push_back(
    6269                        new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), nullptr )
    6370                );
    6471
    65                 mainDecl->get_functionType()->get_parameters().push_back( 
    66                         new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, 0, 
    67                         new PointerType( Type::Qualifiers(), new PointerType( Type::Qualifiers(), new BasicType( Type::Qualifiers(), BasicType::Char ) ) ), 
     72                mainDecl->get_functionType()->get_parameters().push_back(
     73                        new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, 0,
     74                        new PointerType( Type::Qualifiers(), new PointerType( Type::Qualifiers(), new BasicType( Type::Qualifiers(), BasicType::Char ) ) ),
    6875                        nullptr )
    6976                );
     
    7582
    7683        bool is_main(const std::string& name) {
    77                 static std::string mains[] = { 
    78                         mangle_main(), 
     84                static std::string mains[] = {
     85                        mangle_main(),
    7986                        mangle_main_args()
    8087                };
     
    112119                        int nargs = functionDecl->get_functionType()->get_parameters().size();
    113120                        if( !(nargs == 0 || nargs == 2 || nargs == 3) ) {
    114                                 throw SemanticError("Main expected to have 0, 2 or 3 arguments\n", functionDecl); 
     121                                throw SemanticError("Main expected to have 0, 2 or 3 arguments\n", functionDecl);
    115122                        }
    116123                        functionDecl->get_statements()->get_kids().push_back( new ReturnStmt( noLabels, new ConstantExpr( Constant::from_int( 0 ) ) ) );
  • src/CodeGen/FixNames.h

    rf2b12406 rf73f5f4  
    1717#define FIXNAMES_H
    1818
    19 #include "SynTree/SynTree.h"
     19#include <list>  // for list
     20
     21class Declaration;
    2022
    2123namespace CodeGen {
  • src/CodeGen/GenType.cc

    rf2b12406 rf73f5f4  
    1414//
    1515
    16 #include <sstream>
    17 #include <cassert>
    18 
     16#include <cassert>                // for assert, assertf
     17#include <list>                   // for _List_iterator, _List_const_iterator
     18#include <sstream>                // for operator<<, ostringstream, basic_os...
     19
     20#include "CodeGenerator.h"        // for CodeGenerator
    1921#include "GenType.h"
    20 #include "CodeGenerator.h"
    21 
    22 #include "SynTree/Declaration.h"
    23 #include "SynTree/Expression.h"
    24 #include "SynTree/Type.h"
    25 #include "SynTree/Visitor.h"
     22#include "SynTree/Declaration.h"  // for DeclarationWithType
     23#include "SynTree/Expression.h"   // for Expression
     24#include "SynTree/Type.h"         // for PointerType, Type, FunctionType
     25#include "SynTree/Visitor.h"      // for Visitor
    2626
    2727namespace CodeGen {
  • src/CodeGen/GenType.h

    rf2b12406 rf73f5f4  
    1717#define _GENTYPE_H
    1818
    19 #include <string>
    20 #include "SynTree/SynTree.h"
     19#include <string>  // for string
     20
     21class Type;
    2122
    2223namespace CodeGen {
  • src/CodeGen/Generate.cc

    rf2b12406 rf73f5f4  
    1414//
    1515
    16 #include <algorithm>
    17 #include <iostream>
    18 #include <cassert>
    19 #include <list>
     16#include <iostream>                  // for ostream, endl, operator<<
     17#include <list>                      // for list
     18#include <string>                    // for operator<<
    2019
     20#include "CodeGenerator.h"           // for CodeGenerator, doSemicolon, oper...
     21#include "GenType.h"                 // for genPrettyType
    2122#include "Generate.h"
    22 #include "SynTree/Declaration.h"
    23 #include "CodeGenerator.h"
    24 #include "GenType.h"
    25 #include "SynTree/SynTree.h"
    26 #include "SynTree/Type.h"
    27 #include "SynTree/BaseSyntaxNode.h"
    28 // #include "Tuples/Tuples.h"
     23#include "Parser/LinkageSpec.h"      // for isBuiltin, isGeneratable
     24#include "SynTree/BaseSyntaxNode.h"  // for BaseSyntaxNode
     25#include "SynTree/Declaration.h"     // for Declaration
     26#include "SynTree/Type.h"            // for Type
    2927
    3028using namespace std;
  • src/CodeGen/Generate.h

    rf2b12406 rf73f5f4  
    1717#define GENERATE_H
    1818
    19 #include <list>
    20 #include <iostream>
     19#include <iostream>  // for ostream
     20#include <list>      // for list
    2121
    22 #include "SynTree/SynTree.h"
     22class BaseSyntaxNode;
     23class Declaration;
    2324
    2425namespace CodeGen {
  • src/CodeGen/OperatorTable.cc

    rf2b12406 rf73f5f4  
    1414//
    1515
    16 #include <map>
     16#include <map>      // for map, _Rb_tree_const_iterator, map<>::const_iterator
     17#include <utility>  // for pair
     18
    1719#include "OperatorTable.h"
    1820
  • src/CodeTools/DeclStats.cc

    rf2b12406 rf73f5f4  
    1616#include "DeclStats.h"
    1717
    18 #include <iostream>
    19 #include <map>
    20 #include <sstream>
    21 #include <string>
    22 #include <unordered_map>
    23 #include <unordered_set>
    24 
    25 #include "Common/VectorMap.h"
    26 #include "GenPoly/GenPoly.h"
    27 #include "Parser/LinkageSpec.h"
    28 #include "SynTree/Declaration.h"
    29 #include "SynTree/Visitor.h"
     18#include <iostream>                // for operator<<, basic_ostream, cout
     19#include <map>                     // for map
     20#include <string>                  // for string, operator+, operator<<, cha...
     21#include <unordered_map>           // for unordered_map
     22#include <unordered_set>           // for unordered_set
     23#include <utility>                 // for pair, make_pair
     24
     25#include "Common/SemanticError.h"  // for SemanticError
     26#include "Common/VectorMap.h"      // for VectorMap
     27#include "GenPoly/GenPoly.h"       // for hasPolyBase
     28#include "Parser/LinkageSpec.h"    // for ::NoOfSpecs, Spec
     29#include "SynTree/Declaration.h"   // for FunctionDecl, TypeDecl, Declaration
     30#include "SynTree/Expression.h"    // for UntypedExpr, Expression
     31#include "SynTree/Statement.h"     // for CompoundStmt
     32#include "SynTree/Type.h"          // for Type, FunctionType, PointerType
     33#include "SynTree/Visitor.h"       // for maybeAccept, Visitor, acceptAll
    3034
    3135namespace CodeTools {
    32        
     36
    3337        class DeclStats : public Visitor {
    3438                template<typename T>
     
    7579                                sum(n_types, o.n_types);
    7680                                sum(p_new, o.p_new);
    77                                
     81
    7882                                return *this;
    7983                        }
    8084                };
    81                
     85
    8286                struct Stats {
    8387                        unsigned n_decls;     ///< Total number of declarations
     
    98102                        /// Stats for the return list
    99103                        ArgPackStats returns;
    100                        
     104
    101105                        /// Count of declarations with each number of assertions
    102106                        std::map<unsigned, unsigned> n_assns;
     
    105109                        /// Stats for the assertions' return types
    106110                        ArgPackStats assn_returns;
    107                        
     111
    108112                        Stats() : n_decls(0), n_type_params(), by_name(), basic_type_names(), compound_type_names(), basic_type_decls(), compound_type_decls(), params(), returns(), n_assns(), assn_params(), assn_returns() {}
    109113
     
    122126                                sum( assn_params, o.assn_params );
    123127                                sum( assn_returns, o.assn_returns );
    124                                
     128
    125129                                return *this;
    126130                        }
     
    144148
    145149                                n += dt->size();
    146                                
     150
    147151                                std::stringstream ss;
    148152                                dt->print( ss );
     
    176180                        ++pstats.n_types.at( types.size() );
    177181                }
    178                
     182
    179183                void analyzeFunc( FunctionType* fnTy, Stats& stats, ArgPackStats& params, ArgPackStats& returns ) {
    180184                        std::unordered_set<std::string> seen;
     
    186190                        auto& args = expr->get_args();
    187191                        unsigned fanout = args.size();
    188                        
     192
    189193                        ++exprs_by_fanout_at_depth[ std::make_pair(depth, fanout) ];
    190194                        for ( Expression* arg : args ) {
     
    205209                                return;
    206210                        }
    207                        
     211
    208212                        Stats& stats = for_linkage[ decl->get_linkage() ];
    209213
     
    323327                }
    324328
    325                 void printPairMap( const std::string& name, 
     329                void printPairMap( const std::string& name,
    326330                                   const std::map<std::pair<unsigned, unsigned>, unsigned>& map ) {
    327331                        for ( const auto& entry : map ) {
    328332                                const auto& key = entry.first;
    329                                 std::cout << "\"" << name << "\"," << key.first << "," << key.second << "," 
     333                                std::cout << "\"" << name << "\"," << key.first << "," << key.second << ","
    330334                                          << entry.second << std::endl;
    331335                        }
    332336                }
    333                
     337
    334338        public:
    335339                void print() {
     
    366370                stats.print();
    367371        }
    368        
     372
    369373} // namespace CodeTools
    370374
  • src/CodeTools/DeclStats.h

    rf2b12406 rf73f5f4  
    1717#define DECLSTATS_H
    1818
    19 #include "SynTree/SynTree.h"
     19#include <list>  // for list
     20
     21class Declaration;
    2022
    2123namespace CodeTools {
  • src/CodeTools/TrackLoc.cc

    rf2b12406 rf73f5f4  
    1616#include "TrackLoc.h"
    1717
    18 #include <cstdlib>
     18#include <cstdlib>                    // for size_t, exit, EXIT_FAILURE
     19#include <iostream>                   // for operator<<, ostream, basic_ostream
     20#include <iterator>                   // for back_inserter, inserter
     21#include <stack>                      // for stack
     22#include <string>                     // for operator<<, string
     23#include <typeindex>                  // for type_index
    1924
    20 #include <iostream>
    21 #include <sstream>
    22 #include <stack>
    23 #include <string>
    24 #include <typeindex>
     25#include "Common/PassVisitor.h"       // for PassVisitor
     26#include "Common/PassVisitor.impl.h"  // for acceptAll
     27#include "Common/SemanticError.h"     // for SemanticError
     28#include "Common/utility.h"           // for CodeLocation
     29#include "SynTree/BaseSyntaxNode.h"   // for BaseSyntaxNode
     30#include "SynTree/Mutator.h"          // for mutateAll
     31#include "SynTree/Visitor.h"          // for acceptAll
    2532
    26 #include "Common/utility.h"
    27 #include "Common/PassVisitor.h"
    28 #include "Common/VectorMap.h"
    29 #include "GenPoly/GenPoly.h"
    30 #include "Parser/LinkageSpec.h"
    31 #include "SynTree/Declaration.h"
    32 #include "SynTree/Initializer.h"
     33class Declaration;
    3334
    3435namespace CodeTools {
  • src/CodeTools/TrackLoc.h

    rf2b12406 rf73f5f4  
    1717#define TRACKLOC_H
    1818
    19 #include "SynTree/SynTree.h"
     19#include <cstddef>   // for size_t
     20#include <list>      // for list
     21
     22class Declaration;
    2023
    2124namespace CodeTools {
  • src/Common/Assert.cc

    rf2b12406 rf73f5f4  
    1414//
    1515
    16 #include <assert.h>
    17 #include <cstdarg>                                                                              // varargs
    18 #include <cstdio>                                                                               // fprintf
    19 #include <cstdlib>                                                                              // abort
     16#include <cstdarg>  // for va_end, va_list, va_start
     17#include <cstdio>   // for fprintf, stderr, vfprintf
     18#include <cstdlib>  // for abort
    2019
    2120extern const char * __progname;                                                 // global name of running executable (argv[0])
  • src/Common/SemanticError.cc

    rf2b12406 rf73f5f4  
    1414//
    1515
    16 #include <iostream>
    17 #include <list>
    18 #include <string>
    19 #include <algorithm>
    20 #include <iterator>
     16#include <cstdio>            // for fileno, stderr
     17#include <unistd.h>          // for isatty
     18#include <iostream>          // for basic_ostream, operator<<, ostream
     19#include <list>              // for list, _List_iterator
     20#include <string>            // for string, operator<<, operator+, to_string
    2121
     22#include "Common/utility.h"  // for to_string, CodeLocation (ptr only)
    2223#include "SemanticError.h"
    23 
    24 #include <unistd.h>
    2524
    2625inline const std::string& error_str() {
  • src/Common/SemanticError.h

    rf2b12406 rf73f5f4  
    1717#define SEMANTICERROR_H
    1818
    19 #include <exception>
    20 #include <string>
    21 #include <sstream>
    22 #include <list>
    23 #include <iostream>
     19#include <exception>  // for exception
     20#include <iostream>   // for ostream
     21#include <list>       // for list
     22#include <string>     // for string
    2423
    25 #include "utility.h"
     24#include "utility.h"  // for CodeLocation, toString
    2625
    2726struct error {
  • src/Concurrency/Keywords.cc

    rf2b12406 rf73f5f4  
    1717#include "Concurrency/Keywords.h"
    1818
    19 #include "InitTweak/InitTweak.h"
    20 #include "SymTab/AddVisit.h"
    21 #include "SynTree/Declaration.h"
    22 #include "SynTree/Expression.h"
    23 #include "SynTree/Initializer.h"
    24 #include "SynTree/Statement.h"
    25 #include "SynTree/Type.h"
    26 #include "SynTree/Visitor.h"
     19#include <cassert>                 // for assert
     20#include <string>                  // for string, operator==
     21
     22#include "Common/SemanticError.h"  // for SemanticError
     23#include "Common/utility.h"        // for deleteAll, map_range
     24#include "InitTweak/InitTweak.h"   // for isConstructor
     25#include "Parser/LinkageSpec.h"    // for Cforall
     26#include "SymTab/AddVisit.h"       // for acceptAndAdd
     27#include "SynTree/Constant.h"      // for Constant
     28#include "SynTree/Declaration.h"   // for StructDecl, FunctionDecl, ObjectDecl
     29#include "SynTree/Expression.h"    // for VariableExpr, ConstantExpr, Untype...
     30#include "SynTree/Initializer.h"   // for SingleInit, ListInit, Initializer ...
     31#include "SynTree/Label.h"         // for Label
     32#include "SynTree/Statement.h"     // for CompoundStmt, DeclStmt, ExprStmt
     33#include "SynTree/Type.h"          // for StructInstType, Type, PointerType
     34#include "SynTree/Visitor.h"       // for Visitor, acceptAll
     35
     36class Attribute;
    2737
    2838namespace Concurrency {
     
    322332                if( needs_main ) {
    323333                        FunctionType * main_type = new FunctionType( noQualifiers, false );
    324                        
     334
    325335                        main_type->get_parameters().push_back( this_decl->clone() );
    326336
     
    361371        void ConcurrentSueKeyword::addRoutines( ObjectDecl * field, FunctionDecl * func ) {
    362372                CompoundStmt * statement = new CompoundStmt( noLabels );
    363                 statement->push_back( 
     373                statement->push_back(
    364374                        new ReturnStmt(
    365375                                noLabels,
     
    386396        //=============================================================================================
    387397        void MutexKeyword::visit(FunctionDecl* decl) {
    388                 Visitor::visit(decl);           
     398                Visitor::visit(decl);
    389399
    390400                std::list<DeclarationWithType*> mutexArgs = findMutexArgs( decl );
     
    510520        void ThreadStarter::visit(FunctionDecl * decl) {
    511521                Visitor::visit(decl);
    512                
     522
    513523                if( ! InitTweak::isConstructor(decl->get_name()) ) return;
    514524
     
    528538                if( ! stmt ) return;
    529539
    530                 stmt->push_back( 
     540                stmt->push_back(
    531541                        new ExprStmt(
    532542                                noLabels,
  • src/Concurrency/Keywords.h

    rf2b12406 rf73f5f4  
    1818#define KEYWORDS_H
    1919
    20 #include <list>
     20#include <list>  // for list
    2121
    22 #include "SynTree/Declaration.h"
     22class Declaration;
    2323
    2424namespace Concurrency {
  • src/ControlStruct/ExceptTranslate.cc

    rf2b12406 rf73f5f4  
    1010// Created On       : Wed Jun 14 16:49:00 2017
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Fri Jun 30 13:30:00 2017
    13 // Update Count     : 1
     12// Last Modified On : Tus Jul 11 16:33:00 2017
     13// Update Count     : 2
    1414//
    1515
     
    157157        Statement * create_terminate_throw( ThrowStmt *throwStmt ) {
    158158                // { int NAME = EXPR; __throw_terminate( &NAME ); }
    159                 return create_given_throw( "__cfaehm__throw_termination", throwStmt );
     159                return create_given_throw( "__cfaehm__throw_terminate", throwStmt );
    160160        }
    161161        Statement * create_terminate_rethrow( ThrowStmt *throwStmt ) {
     
    164164                Statement * result = new ExprStmt(
    165165                        throwStmt->get_labels(),
    166                         new UntypedExpr( new NameExpr( "__cfaehm__rethrow_termination" ) )
     166                        new UntypedExpr( new NameExpr( "__cfaehm__rethrow_terminate" ) )
    167167                        );
    168168                delete throwStmt;
     
    171171        Statement * create_resume_throw( ThrowStmt *throwStmt ) {
    172172                // __throw_resume( EXPR );
    173                 return create_given_throw( "__cfaehm__throw_resumption", throwStmt );
     173                return create_given_throw( "__cfaehm__throw_resume", throwStmt );
    174174        }
    175175        Statement * create_resume_rethrow( ThrowStmt *throwStmt ) {
  • src/MakeLibCfa.cc

    rf2b12406 rf73f5f4  
    1515
    1616#include "MakeLibCfa.h"
    17 #include "SynTree/Visitor.h"
    18 #include "SynTree/Declaration.h"
    19 #include "SynTree/Type.h"
    20 #include "SynTree/Expression.h"
    21 #include "SynTree/Statement.h"
    22 #include "SynTree/Initializer.h"
    23 #include "CodeGen/OperatorTable.h"
    24 #include "Common/UniqueName.h"
     17
     18#include <cassert>                 // for assert
     19#include <string>                   // for operator==, string
     20
     21#include "CodeGen/OperatorTable.h"  // for OperatorInfo, operatorLookup, Ope...
     22#include "Common/SemanticError.h"   // for SemanticError
     23#include "Common/UniqueName.h"      // for UniqueName
     24#include "Parser/LinkageSpec.h"     // for Spec, Intrinsic, C
     25#include "SynTree/Declaration.h"    // for FunctionDecl, ObjectDecl, Declara...
     26#include "SynTree/Expression.h"     // for NameExpr, UntypedExpr, VariableExpr
     27#include "SynTree/Initializer.h"    // for SingleInit
     28#include "SynTree/Label.h"          // for Label
     29#include "SynTree/Statement.h"      // for CompoundStmt, ReturnStmt
     30#include "SynTree/Type.h"           // for FunctionType
     31#include "SynTree/Visitor.h"        // for acceptAll, Visitor
    2532
    2633namespace LibCfa {
  • src/MakeLibCfa.h

    rf2b12406 rf73f5f4  
    1717#define LIBCFA_MAKELIBCFA_H
    1818
    19 #include <list>
    20 #include <SynTree/SynTree.h>
     19#include <list>  // for list
     20
     21class Declaration;
    2122
    2223namespace LibCfa {
  • src/Parser/StatementNode.cc

    rf2b12406 rf73f5f4  
    1010// Created On       : Sat May 16 14:59:41 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jun 28 21:08:37 2017
    13 // Update Count     : 330
     12// Last Modified On : Tue Jul 11 21:23:15 2017
     13// Update Count     : 331
    1414//
    1515
     
    9393        std::list< Statement * > branches;
    9494        buildMoveList< Statement, StatementNode >( stmt, branches );
    95         assert( branches.size() >= 0 );                                         // size == 0 for switch (...) {}, i.e., no declaration or statements
     95        // branches.size() == 0 for switch (...) {}, i.e., no declaration or statements
    9696        return new SwitchStmt( noLabels, maybeMoveBuild< Expression >(ctl), branches );
    9797}
  • src/Parser/lex.ll

    rf2b12406 rf73f5f4  
    1010 * Created On       : Sat Sep 22 08:58:10 2001
    1111 * Last Modified By : Peter A. Buhr
    12  * Last Modified On : Wed Jun 28 21:03:45 2017
    13  * Update Count     : 529
     12 * Last Modified On : Tue Jul 11 21:30:51 2017
     13 * Update Count     : 534
    1414 */
    1515
     
    5959}
    6060
     61// Stop warning due to incorrectly generated flex code.
     62#pragma GCC diagnostic ignored "-Wsign-compare"
    6163%}
    6264
  • src/Parser/parser.yy

    rf2b12406 rf73f5f4  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Fri Jun 30 15:38:00 2017
    13 // Update Count     : 2415
     12// Last Modified On : Tus Jul 11 13:39:00 2017
     13// Update Count     : 2416
    1414//
    1515
     
    21762176                {
    21772177                        linkageStack.push( linkage );                           // handle nested extern "C"/"Cforall"
    2178                         linkage = LinkageSpec::linkageCheck( $2 );
     2178                        linkage = LinkageSpec::linkageUpdate( linkage, $2 );
    21792179                }
    21802180          '{' external_definition_list_opt '}'
  • src/benchmark/Makefile.am

    rf2b12406 rf73f5f4  
    2020CC = @CFA_BINDIR@/@CFA_NAME@
    2121
    22 noinst_PROGRAMS = bench ctxswitch-coroutine ctxswitch-thread
     22noinst_PROGRAMS = bench$(EXEEXT) ctxswitch-coroutine$(EXEEXT) ctxswitch-thread$(EXEEXT) sched-int$(EXEEXT) monitor$(EXEEXT) csv-data$(EXEEXT)
    2323
    24 bench :
     24bench$(EXEEXT) :
    2525        @for ccflags in "-debug" "-nodebug"; do \
    2626                echo ${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -lrt bench.c;\
     
    3030        rm -f ./a.out ;
    3131
    32 ctxswitch-coroutine:
     32ctxswitch-coroutine$(EXEEXT):
    3333        ${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -DN=10000000 CorCtxSwitch.c
    3434        @for number in 1 2 3 4 5 6 7 8 9 10; do \
     
    3737        @rm -f ./a.out
    3838
    39 ctxswitch-thread:
     39ctxswitch-thread$(EXEEXT):
    4040        ${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -DN=10000000 ThrdCtxSwitch.c
    4141        @for number in 1 2 3 4 5 6 7 8 9 10; do \
     
    4444        @rm -f ./a.out
    4545
    46 sched-int:
     46sched-int$(EXEEXT):
    4747        ${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -DN=10000000 SchedInt.c
    4848        @for number in 1 2 3 4 5 6 7 8 9 10; do \
     
    5151        @rm -f ./a.out
    5252
    53 monitor:
     53monitor$(EXEEXT):
    5454        ${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -DN=10000000 Monitor.c
    5555        @for number in 1 2 3 4 5 6 7 8 9 10; do \
     
    5858        @rm -f ./a.out
    5959
    60 csv-data:
     60csv-data$(EXEEXT):
    6161        @${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -quiet -DN=10000000 csv-data.c
    6262        @./a.out
  • src/benchmark/Makefile.in

    rf2b12406 rf73f5f4  
    9292build_triplet = @build@
    9393host_triplet = @host@
    94 noinst_PROGRAMS = bench$(EXEEXT) ctxswitch-coroutine$(EXEEXT) \
    95         ctxswitch-thread$(EXEEXT)
    9694subdir = src/benchmark
    9795ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
     
    108106bench_OBJECTS = bench.$(OBJEXT)
    109107bench_LDADD = $(LDADD)
     108csv_data_SOURCES = csv-data.c
     109csv_data_OBJECTS = csv-data.$(OBJEXT)
     110csv_data_LDADD = $(LDADD)
    110111ctxswitch_coroutine_SOURCES = ctxswitch-coroutine.c
    111112ctxswitch_coroutine_OBJECTS = ctxswitch-coroutine.$(OBJEXT)
     
    114115ctxswitch_thread_OBJECTS = ctxswitch-thread.$(OBJEXT)
    115116ctxswitch_thread_LDADD = $(LDADD)
     117monitor_SOURCES = monitor.c
     118monitor_OBJECTS = monitor.$(OBJEXT)
     119monitor_LDADD = $(LDADD)
     120sched_int_SOURCES = sched-int.c
     121sched_int_OBJECTS = sched-int.$(OBJEXT)
     122sched_int_LDADD = $(LDADD)
    116123AM_V_P = $(am__v_P_@AM_V@)
    117124am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
     
    142149am__v_CCLD_0 = @echo "  CCLD    " $@;
    143150am__v_CCLD_1 =
    144 SOURCES = bench.c ctxswitch-coroutine.c ctxswitch-thread.c
    145 DIST_SOURCES = bench.c ctxswitch-coroutine.c ctxswitch-thread.c
     151SOURCES = bench.c csv-data.c ctxswitch-coroutine.c ctxswitch-thread.c \
     152        monitor.c sched-int.c
     153DIST_SOURCES = bench.c csv-data.c ctxswitch-coroutine.c \
     154        ctxswitch-thread.c monitor.c sched-int.c
    146155am__can_run_installinfo = \
    147156  case $$AM_UPDATE_INFO_DIR in \
     
    293302top_srcdir = @top_srcdir@
    294303AM_CFLAGS = -g -Wall -Wno-unused-function -O2
     304noinst_PROGRAMS = bench$(EXEEXT) ctxswitch-coroutine$(EXEEXT) ctxswitch-thread$(EXEEXT) sched-int$(EXEEXT) monitor$(EXEEXT) csv-data$(EXEEXT)
    295305all: all-am
    296306
     
    337347
    338348@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bench.Po@am__quote@
     349@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/csv-data.Po@am__quote@
    339350@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ctxswitch-coroutine.Po@am__quote@
    340351@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ctxswitch-thread.Po@am__quote@
     352@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/monitor.Po@am__quote@
     353@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sched-int.Po@am__quote@
    341354
    342355.c.o:
     
    559572
    560573
    561 bench :
     574bench$(EXEEXT) :
    562575        @for ccflags in "-debug" "-nodebug"; do \
    563576                echo ${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -lrt bench.c;\
     
    567580        rm -f ./a.out ;
    568581
    569 ctxswitch-coroutine:
     582ctxswitch-coroutine$(EXEEXT):
    570583        ${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -DN=10000000 CorCtxSwitch.c
    571584        @for number in 1 2 3 4 5 6 7 8 9 10; do \
     
    574587        @rm -f ./a.out
    575588
    576 ctxswitch-thread:
     589ctxswitch-thread$(EXEEXT):
    577590        ${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -DN=10000000 ThrdCtxSwitch.c
    578591        @for number in 1 2 3 4 5 6 7 8 9 10; do \
     
    581594        @rm -f ./a.out
    582595
    583 sched-int:
     596sched-int$(EXEEXT):
    584597        ${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -DN=10000000 SchedInt.c
    585598        @for number in 1 2 3 4 5 6 7 8 9 10; do \
     
    588601        @rm -f ./a.out
    589602
    590 monitor:
     603monitor$(EXEEXT):
    591604        ${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -DN=10000000 Monitor.c
    592605        @for number in 1 2 3 4 5 6 7 8 9 10; do \
     
    595608        @rm -f ./a.out
    596609
    597 csv-data:
     610csv-data$(EXEEXT):
    598611        @${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -quiet -DN=10000000 csv-data.c
    599612        @./a.out
  • src/include/assert.h

    rf2b12406 rf73f5f4  
    1515
    1616#pragma once
     17// Pragmas for header cleanup tool
     18// IWYU pragma: private, include <cassert>
    1719
    1820#include_next <assert.h>
  • src/libcfa/exception.c

    rf2b12406 rf73f5f4  
    1010// Created On       : Mon Jun 26 15:13:00 2017
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Mon Nov 26 15:11:00 2017
    13 // Update Count     : 0
     12// Last Modified On : Tus Jul 11 16:36:00 2017
     13// Update Count     : 1
    1414//
    1515
     
    4444// RESUMPTION ================================================================
    4545
    46 void __cfaehm__throw_resumption(exception * except) {
     46void __cfaehm__throw_resume(exception * except) {
    4747
    4848        // DEBUG
     
    6565
    6666        // Fall back to termination:
    67         __cfaehm__throw_termination(except);
     67        __cfaehm__throw_terminate(except);
    6868        // TODO: Default handler for resumption.
    6969}
     
    111111}
    112112
    113 void __cfaehm__throw_termination( exception * val ) {
     113void __cfaehm__throw_terminate( exception * val ) {
    114114        // Store the current exception
    115115        shared_stack.current_exception = *val;
     
    147147
    148148// Nesting this the other way would probably be faster.
    149 void __cfaehm__rethrow_termination(void) {
     149void __cfaehm__rethrow_terminate(void) {
    150150        // DEBUG
    151151        printf("Rethrowing termination exception\n");
    152152
    153         __cfaehm__throw_termination(&shared_stack.current_exception);
     153        __cfaehm__throw_terminate(&shared_stack.current_exception);
    154154}
    155155
  • src/libcfa/exception.h

    rf2b12406 rf73f5f4  
    1010// Created On       : Mon Jun 26 15:11:00 2017
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Mon Nov 26 15:11:00 2017
    13 // Update Count     : 0
     12// Last Modified On : Tus Jul 11 16:31:00 2017
     13// Update Count     : 2
    1414//
    1515
     
    2222
    2323#ifdef __CFORALL__
    24 extern "BuiltinC" {
     24extern "C" {
    2525#endif
    2626
    2727// Used in throw statement translation.
    28 void __cfaehm__throw_termination(exception * except) __attribute__((noreturn));
    29 void __cfaehm__rethrow_termination() __attribute__((noreturn));
    30 void __cfaehm__throw_resumption(exception * except);
     28void __cfaehm__throw_terminate(exception * except) __attribute__((noreturn));
     29void __cfaehm__rethrow_terminate() __attribute__((noreturn));
     30void __cfaehm__throw_resume(exception * except);
    3131
    3232// Function catches termination exceptions.
  • src/main.cc

    rf2b12406 rf73f5f4  
    1515//
    1616
    17 #include <iostream>
    18 #include <fstream>
    19 #include <signal.h>                                                                             // signal
    20 #include <getopt.h>                                                                             // getopt
    21 #include <execinfo.h>                                                                   // backtrace, backtrace_symbols
    22 #include <cxxabi.h>                                                                             // __cxa_demangle
    23 #include <cstring>                                                                              // index
    24 
    25 using namespace std;
    26 
    27 #include "Parser/ParserTypes.h"
    28 #include "Parser/TypedefTable.h"
    29 #include "GenPoly/Lvalue.h"
    30 #include "GenPoly/Specialize.h"
    31 #include "GenPoly/Box.h"
    32 #include "GenPoly/CopyParams.h"
    33 #include "GenPoly/InstantiateGeneric.h"
    34 #include "Concurrency/Keywords.h"
    35 #include "CodeGen/Generate.h"
    36 #include "CodeGen/FixNames.h"
    37 #include "CodeGen/FixMain.h"
    38 #include "CodeTools/DeclStats.h"
    39 #include "CodeTools/TrackLoc.h"
    40 #include "ControlStruct/Mutate.h"
    41 #include "ControlStruct/ExceptTranslate.h"
    42 #include "SymTab/Validate.h"
    43 #include "ResolvExpr/AlternativePrinter.h"
    44 #include "ResolvExpr/Resolver.h"
    45 #include "MakeLibCfa.h"
    46 #include "InitTweak/GenInit.h"
    47 #include "InitTweak/FixInit.h"
    48 #include "Common/UnimplementedError.h"
    49 #include "../config.h"
    50 #include "Tuples/Tuples.h"
     17#include <cassert>                          // for assertf
     18#include <cxxabi.h>                         // for __cxa_demangle
     19#include <execinfo.h>                       // for backtrace, backtrace_symbols
     20#include <getopt.h>                         // for no_argument, optind, geto...
     21#include <signal.h>                         // for signal, SIGABRT, SIGSEGV
     22#include <cstdio>                           // for fopen, FILE, fclose, stdin
     23#include <cstdlib>                          // for exit, free, abort, EXIT_F...
     24#include <cstring>                          // for index
     25#include <fstream>                          // for ofstream
     26#include <iostream>                         // for operator<<, basic_ostream
     27#include <iterator>                         // for back_inserter
     28#include <list>                             // for list
     29#include <string>                           // for operator<<, allocator
     30
     31#include "../config.h"                      // for CFA_LIBDIR
     32#include "CodeGen/FixMain.h"                // for FixMain
     33#include "CodeGen/FixNames.h"               // for fixNames
     34#include "CodeGen/Generate.h"               // for generate
     35#include "CodeTools/DeclStats.h"            // for printDeclStats
     36#include "CodeTools/TrackLoc.h"             // for fillLocations
     37#include "Common/CompilerError.h"           // for CompilerError
     38#include "Common/SemanticError.h"           // for SemanticError
     39#include "Common/UnimplementedError.h"      // for UnimplementedError
     40#include "Common/utility.h"                 // for deleteAll, filter, printAll
     41#include "ControlStruct/ExceptTranslate.h"  // for translateEHM
     42#include "ControlStruct/Mutate.h"           // for mutate
     43#include "GenPoly/Box.h"                    // for box
     44#include "GenPoly/CopyParams.h"             // for copyParams
     45#include "GenPoly/InstantiateGeneric.h"     // for instantiateGeneric
     46#include "GenPoly/Lvalue.h"                 // for convertLvalue
     47#include "GenPoly/Specialize.h"             // for convertSpecializations
     48#include "InitTweak/FixInit.h"              // for fix
     49#include "InitTweak/GenInit.h"              // for genInit
     50#include "MakeLibCfa.h"                     // for makeLibCfa
     51#include "Parser/LinkageSpec.h"             // for Spec, Cforall, Intrinsic
     52#include "Parser/ParseNode.h"               // for DeclarationNode, buildList
     53#include "Parser/TypedefTable.h"            // for TypedefTable
     54#include "ResolvExpr/AlternativePrinter.h"  // for AlternativePrinter
     55#include "ResolvExpr/Resolver.h"            // for resolve
     56#include "SymTab/Validate.h"                // for validate
     57#include "SynTree/Declaration.h"            // for Declaration
     58#include "SynTree/Visitor.h"                // for acceptAll
     59#include "Tuples/Tuples.h"                  // for expandMemberTuples, expan...
    5160
    5261using namespace std;
Note: See TracChangeset for help on using the changeset viewer.