Changeset f73f5f4
- Timestamp:
- Jul 12, 2017, 10:14:15 AM (7 years ago)
- 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:
- 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. - Location:
- src
- Files:
-
- 31 edited
Legend:
- Unmodified
- Added
- Removed
-
src/CodeGen/CodeGenerator.cc
rf2b12406 rf73f5f4 14 14 // 15 15 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... 32 18 33 19 #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... 38 36 39 37 using namespace std; -
src/CodeGen/CodeGenerator.h
rf2b12406 rf73f5f4 17 17 #define CODEGENV_H 18 18 19 #include <list> 19 #include <list> // for list 20 #include <ostream> // for ostream, operator<< 21 #include <string> // for string 20 22 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 28 26 29 27 namespace CodeGen { -
src/CodeGen/FixMain.cc
rf2b12406 rf73f5f4 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // FixMain.cc -- 7 // FixMain.cc -- 8 8 // 9 9 // Author : Thierry Delisle 10 10 // 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 : 13 13 // Update Count : 0 14 14 // 15 15 16 16 17 #include "FixMain.h" 17 #include "FixMain.h" 18 18 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<< 21 23 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 24 27 25 28 namespace CodeGen { 26 29 bool FixMain::replace_main = false; 27 30 std::unique_ptr<FunctionDecl> FixMain::main_signature = nullptr; 28 29 void FixMain::registerMain(FunctionDecl* functionDecl) 31 32 void FixMain::registerMain(FunctionDecl* functionDecl) 30 33 { 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); 33 36 } 34 37 main_signature.reset( functionDecl->clone() ); -
src/CodeGen/FixNames.cc
rf2b12406 rf73f5f4 14 14 // 15 15 16 #include <memory>16 #include "FixNames.h" 17 17 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 25 32 26 33 namespace CodeGen { … … 42 49 main_type = new FunctionType( Type::Qualifiers(), true ), nullptr ) 43 50 }; 44 main_type->get_returnVals().push_back( 51 main_type->get_returnVals().push_back( 45 52 new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), nullptr ) 46 53 ); … … 52 59 std::string mangle_main_args() { 53 60 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, 55 62 main_type = new FunctionType( Type::Qualifiers(), false ), nullptr ) 56 63 }; 57 main_type->get_returnVals().push_back( 64 main_type->get_returnVals().push_back( 58 65 new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), nullptr ) 59 66 ); 60 67 61 mainDecl->get_functionType()->get_parameters().push_back( 68 mainDecl->get_functionType()->get_parameters().push_back( 62 69 new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), nullptr ) 63 70 ); 64 71 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 ) ) ), 68 75 nullptr ) 69 76 ); … … 75 82 76 83 bool is_main(const std::string& name) { 77 static std::string mains[] = { 78 mangle_main(), 84 static std::string mains[] = { 85 mangle_main(), 79 86 mangle_main_args() 80 87 }; … … 112 119 int nargs = functionDecl->get_functionType()->get_parameters().size(); 113 120 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); 115 122 } 116 123 functionDecl->get_statements()->get_kids().push_back( new ReturnStmt( noLabels, new ConstantExpr( Constant::from_int( 0 ) ) ) ); -
src/CodeGen/FixNames.h
rf2b12406 rf73f5f4 17 17 #define FIXNAMES_H 18 18 19 #include "SynTree/SynTree.h" 19 #include <list> // for list 20 21 class Declaration; 20 22 21 23 namespace CodeGen { -
src/CodeGen/GenType.cc
rf2b12406 rf73f5f4 14 14 // 15 15 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 19 21 #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 26 26 27 27 namespace CodeGen { -
src/CodeGen/GenType.h
rf2b12406 rf73f5f4 17 17 #define _GENTYPE_H 18 18 19 #include <string> 20 #include "SynTree/SynTree.h" 19 #include <string> // for string 20 21 class Type; 21 22 22 23 namespace CodeGen { -
src/CodeGen/Generate.cc
rf2b12406 rf73f5f4 14 14 // 15 15 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<< 20 19 20 #include "CodeGenerator.h" // for CodeGenerator, doSemicolon, oper... 21 #include "GenType.h" // for genPrettyType 21 22 #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 29 27 30 28 using namespace std; -
src/CodeGen/Generate.h
rf2b12406 rf73f5f4 17 17 #define GENERATE_H 18 18 19 #include < list>20 #include < iostream>19 #include <iostream> // for ostream 20 #include <list> // for list 21 21 22 #include "SynTree/SynTree.h" 22 class BaseSyntaxNode; 23 class Declaration; 23 24 24 25 namespace CodeGen { -
src/CodeGen/OperatorTable.cc
rf2b12406 rf73f5f4 14 14 // 15 15 16 #include <map> 16 #include <map> // for map, _Rb_tree_const_iterator, map<>::const_iterator 17 #include <utility> // for pair 18 17 19 #include "OperatorTable.h" 18 20 -
src/CodeTools/DeclStats.cc
rf2b12406 rf73f5f4 16 16 #include "DeclStats.h" 17 17 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 30 34 31 35 namespace CodeTools { 32 36 33 37 class DeclStats : public Visitor { 34 38 template<typename T> … … 75 79 sum(n_types, o.n_types); 76 80 sum(p_new, o.p_new); 77 81 78 82 return *this; 79 83 } 80 84 }; 81 85 82 86 struct Stats { 83 87 unsigned n_decls; ///< Total number of declarations … … 98 102 /// Stats for the return list 99 103 ArgPackStats returns; 100 104 101 105 /// Count of declarations with each number of assertions 102 106 std::map<unsigned, unsigned> n_assns; … … 105 109 /// Stats for the assertions' return types 106 110 ArgPackStats assn_returns; 107 111 108 112 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() {} 109 113 … … 122 126 sum( assn_params, o.assn_params ); 123 127 sum( assn_returns, o.assn_returns ); 124 128 125 129 return *this; 126 130 } … … 144 148 145 149 n += dt->size(); 146 150 147 151 std::stringstream ss; 148 152 dt->print( ss ); … … 176 180 ++pstats.n_types.at( types.size() ); 177 181 } 178 182 179 183 void analyzeFunc( FunctionType* fnTy, Stats& stats, ArgPackStats& params, ArgPackStats& returns ) { 180 184 std::unordered_set<std::string> seen; … … 186 190 auto& args = expr->get_args(); 187 191 unsigned fanout = args.size(); 188 192 189 193 ++exprs_by_fanout_at_depth[ std::make_pair(depth, fanout) ]; 190 194 for ( Expression* arg : args ) { … … 205 209 return; 206 210 } 207 211 208 212 Stats& stats = for_linkage[ decl->get_linkage() ]; 209 213 … … 323 327 } 324 328 325 void printPairMap( const std::string& name, 329 void printPairMap( const std::string& name, 326 330 const std::map<std::pair<unsigned, unsigned>, unsigned>& map ) { 327 331 for ( const auto& entry : map ) { 328 332 const auto& key = entry.first; 329 std::cout << "\"" << name << "\"," << key.first << "," << key.second << "," 333 std::cout << "\"" << name << "\"," << key.first << "," << key.second << "," 330 334 << entry.second << std::endl; 331 335 } 332 336 } 333 337 334 338 public: 335 339 void print() { … … 366 370 stats.print(); 367 371 } 368 372 369 373 } // namespace CodeTools 370 374 -
src/CodeTools/DeclStats.h
rf2b12406 rf73f5f4 17 17 #define DECLSTATS_H 18 18 19 #include "SynTree/SynTree.h" 19 #include <list> // for list 20 21 class Declaration; 20 22 21 23 namespace CodeTools { -
src/CodeTools/TrackLoc.cc
rf2b12406 rf73f5f4 16 16 #include "TrackLoc.h" 17 17 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 19 24 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 25 32 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" 33 class Declaration; 33 34 34 35 namespace CodeTools { -
src/CodeTools/TrackLoc.h
rf2b12406 rf73f5f4 17 17 #define TRACKLOC_H 18 18 19 #include "SynTree/SynTree.h" 19 #include <cstddef> // for size_t 20 #include <list> // for list 21 22 class Declaration; 20 23 21 24 namespace CodeTools { -
src/Common/Assert.cc
rf2b12406 rf73f5f4 14 14 // 15 15 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 20 19 21 20 extern const char * __progname; // global name of running executable (argv[0]) -
src/Common/SemanticError.cc
rf2b12406 rf73f5f4 14 14 // 15 15 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 21 21 22 #include "Common/utility.h" // for to_string, CodeLocation (ptr only) 22 23 #include "SemanticError.h" 23 24 #include <unistd.h>25 24 26 25 inline const std::string& error_str() { -
src/Common/SemanticError.h
rf2b12406 rf73f5f4 17 17 #define SEMANTICERROR_H 18 18 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 24 23 25 #include "utility.h" 24 #include "utility.h" // for CodeLocation, toString 26 25 27 26 struct error { -
src/Concurrency/Keywords.cc
rf2b12406 rf73f5f4 17 17 #include "Concurrency/Keywords.h" 18 18 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 36 class Attribute; 27 37 28 38 namespace Concurrency { … … 322 332 if( needs_main ) { 323 333 FunctionType * main_type = new FunctionType( noQualifiers, false ); 324 334 325 335 main_type->get_parameters().push_back( this_decl->clone() ); 326 336 … … 361 371 void ConcurrentSueKeyword::addRoutines( ObjectDecl * field, FunctionDecl * func ) { 362 372 CompoundStmt * statement = new CompoundStmt( noLabels ); 363 statement->push_back( 373 statement->push_back( 364 374 new ReturnStmt( 365 375 noLabels, … … 386 396 //============================================================================================= 387 397 void MutexKeyword::visit(FunctionDecl* decl) { 388 Visitor::visit(decl); 398 Visitor::visit(decl); 389 399 390 400 std::list<DeclarationWithType*> mutexArgs = findMutexArgs( decl ); … … 510 520 void ThreadStarter::visit(FunctionDecl * decl) { 511 521 Visitor::visit(decl); 512 522 513 523 if( ! InitTweak::isConstructor(decl->get_name()) ) return; 514 524 … … 528 538 if( ! stmt ) return; 529 539 530 stmt->push_back( 540 stmt->push_back( 531 541 new ExprStmt( 532 542 noLabels, -
src/Concurrency/Keywords.h
rf2b12406 rf73f5f4 18 18 #define KEYWORDS_H 19 19 20 #include <list> 20 #include <list> // for list 21 21 22 #include "SynTree/Declaration.h" 22 class Declaration; 23 23 24 24 namespace Concurrency { -
src/ControlStruct/ExceptTranslate.cc
rf2b12406 rf73f5f4 10 10 // Created On : Wed Jun 14 16:49:00 2017 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Fri Jun 30 13:30:00 201713 // Update Count : 112 // Last Modified On : Tus Jul 11 16:33:00 2017 13 // Update Count : 2 14 14 // 15 15 … … 157 157 Statement * create_terminate_throw( ThrowStmt *throwStmt ) { 158 158 // { int NAME = EXPR; __throw_terminate( &NAME ); } 159 return create_given_throw( "__cfaehm__throw_terminat ion", throwStmt );159 return create_given_throw( "__cfaehm__throw_terminate", throwStmt ); 160 160 } 161 161 Statement * create_terminate_rethrow( ThrowStmt *throwStmt ) { … … 164 164 Statement * result = new ExprStmt( 165 165 throwStmt->get_labels(), 166 new UntypedExpr( new NameExpr( "__cfaehm__rethrow_terminat ion" ) )166 new UntypedExpr( new NameExpr( "__cfaehm__rethrow_terminate" ) ) 167 167 ); 168 168 delete throwStmt; … … 171 171 Statement * create_resume_throw( ThrowStmt *throwStmt ) { 172 172 // __throw_resume( EXPR ); 173 return create_given_throw( "__cfaehm__throw_resum ption", throwStmt );173 return create_given_throw( "__cfaehm__throw_resume", throwStmt ); 174 174 } 175 175 Statement * create_resume_rethrow( ThrowStmt *throwStmt ) { -
src/MakeLibCfa.cc
rf2b12406 rf73f5f4 15 15 16 16 #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 25 32 26 33 namespace LibCfa { -
src/MakeLibCfa.h
rf2b12406 rf73f5f4 17 17 #define LIBCFA_MAKELIBCFA_H 18 18 19 #include <list> 20 #include <SynTree/SynTree.h> 19 #include <list> // for list 20 21 class Declaration; 21 22 22 23 namespace LibCfa { -
src/Parser/StatementNode.cc
rf2b12406 rf73f5f4 10 10 // Created On : Sat May 16 14:59:41 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jun 28 21:08:37201713 // Update Count : 33 012 // Last Modified On : Tue Jul 11 21:23:15 2017 13 // Update Count : 331 14 14 // 15 15 … … 93 93 std::list< Statement * > branches; 94 94 buildMoveList< Statement, StatementNode >( stmt, branches ); 95 assert( branches.size() >= 0 ); // size== 0 for switch (...) {}, i.e., no declaration or statements95 // branches.size() == 0 for switch (...) {}, i.e., no declaration or statements 96 96 return new SwitchStmt( noLabels, maybeMoveBuild< Expression >(ctl), branches ); 97 97 } -
src/Parser/lex.ll
rf2b12406 rf73f5f4 10 10 * Created On : Sat Sep 22 08:58:10 2001 11 11 * Last Modified By : Peter A. Buhr 12 * Last Modified On : Wed Jun 28 21:03:45201713 * Update Count : 5 2912 * Last Modified On : Tue Jul 11 21:30:51 2017 13 * Update Count : 534 14 14 */ 15 15 … … 59 59 } 60 60 61 // Stop warning due to incorrectly generated flex code. 62 #pragma GCC diagnostic ignored "-Wsign-compare" 61 63 %} 62 64 -
src/Parser/parser.yy
rf2b12406 rf73f5f4 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Fri Jun 30 15:38:00 201713 // Update Count : 241 512 // Last Modified On : Tus Jul 11 13:39:00 2017 13 // Update Count : 2416 14 14 // 15 15 … … 2176 2176 { 2177 2177 linkageStack.push( linkage ); // handle nested extern "C"/"Cforall" 2178 linkage = LinkageSpec::linkage Check($2 );2178 linkage = LinkageSpec::linkageUpdate( linkage, $2 ); 2179 2179 } 2180 2180 '{' external_definition_list_opt '}' -
src/benchmark/Makefile.am
rf2b12406 rf73f5f4 20 20 CC = @CFA_BINDIR@/@CFA_NAME@ 21 21 22 noinst_PROGRAMS = bench ctxswitch-coroutine ctxswitch-thread22 noinst_PROGRAMS = bench$(EXEEXT) ctxswitch-coroutine$(EXEEXT) ctxswitch-thread$(EXEEXT) sched-int$(EXEEXT) monitor$(EXEEXT) csv-data$(EXEEXT) 23 23 24 bench :24 bench$(EXEEXT) : 25 25 @for ccflags in "-debug" "-nodebug"; do \ 26 26 echo ${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -lrt bench.c;\ … … 30 30 rm -f ./a.out ; 31 31 32 ctxswitch-coroutine :32 ctxswitch-coroutine$(EXEEXT): 33 33 ${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -DN=10000000 CorCtxSwitch.c 34 34 @for number in 1 2 3 4 5 6 7 8 9 10; do \ … … 37 37 @rm -f ./a.out 38 38 39 ctxswitch-thread :39 ctxswitch-thread$(EXEEXT): 40 40 ${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -DN=10000000 ThrdCtxSwitch.c 41 41 @for number in 1 2 3 4 5 6 7 8 9 10; do \ … … 44 44 @rm -f ./a.out 45 45 46 sched-int :46 sched-int$(EXEEXT): 47 47 ${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -DN=10000000 SchedInt.c 48 48 @for number in 1 2 3 4 5 6 7 8 9 10; do \ … … 51 51 @rm -f ./a.out 52 52 53 monitor :53 monitor$(EXEEXT): 54 54 ${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -DN=10000000 Monitor.c 55 55 @for number in 1 2 3 4 5 6 7 8 9 10; do \ … … 58 58 @rm -f ./a.out 59 59 60 csv-data :60 csv-data$(EXEEXT): 61 61 @${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -quiet -DN=10000000 csv-data.c 62 62 @./a.out -
src/benchmark/Makefile.in
rf2b12406 rf73f5f4 92 92 build_triplet = @build@ 93 93 host_triplet = @host@ 94 noinst_PROGRAMS = bench$(EXEEXT) ctxswitch-coroutine$(EXEEXT) \95 ctxswitch-thread$(EXEEXT)96 94 subdir = src/benchmark 97 95 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 … … 108 106 bench_OBJECTS = bench.$(OBJEXT) 109 107 bench_LDADD = $(LDADD) 108 csv_data_SOURCES = csv-data.c 109 csv_data_OBJECTS = csv-data.$(OBJEXT) 110 csv_data_LDADD = $(LDADD) 110 111 ctxswitch_coroutine_SOURCES = ctxswitch-coroutine.c 111 112 ctxswitch_coroutine_OBJECTS = ctxswitch-coroutine.$(OBJEXT) … … 114 115 ctxswitch_thread_OBJECTS = ctxswitch-thread.$(OBJEXT) 115 116 ctxswitch_thread_LDADD = $(LDADD) 117 monitor_SOURCES = monitor.c 118 monitor_OBJECTS = monitor.$(OBJEXT) 119 monitor_LDADD = $(LDADD) 120 sched_int_SOURCES = sched-int.c 121 sched_int_OBJECTS = sched-int.$(OBJEXT) 122 sched_int_LDADD = $(LDADD) 116 123 AM_V_P = $(am__v_P_@AM_V@) 117 124 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) … … 142 149 am__v_CCLD_0 = @echo " CCLD " $@; 143 150 am__v_CCLD_1 = 144 SOURCES = bench.c ctxswitch-coroutine.c ctxswitch-thread.c 145 DIST_SOURCES = bench.c ctxswitch-coroutine.c ctxswitch-thread.c 151 SOURCES = bench.c csv-data.c ctxswitch-coroutine.c ctxswitch-thread.c \ 152 monitor.c sched-int.c 153 DIST_SOURCES = bench.c csv-data.c ctxswitch-coroutine.c \ 154 ctxswitch-thread.c monitor.c sched-int.c 146 155 am__can_run_installinfo = \ 147 156 case $$AM_UPDATE_INFO_DIR in \ … … 293 302 top_srcdir = @top_srcdir@ 294 303 AM_CFLAGS = -g -Wall -Wno-unused-function -O2 304 noinst_PROGRAMS = bench$(EXEEXT) ctxswitch-coroutine$(EXEEXT) ctxswitch-thread$(EXEEXT) sched-int$(EXEEXT) monitor$(EXEEXT) csv-data$(EXEEXT) 295 305 all: all-am 296 306 … … 337 347 338 348 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bench.Po@am__quote@ 349 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/csv-data.Po@am__quote@ 339 350 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ctxswitch-coroutine.Po@am__quote@ 340 351 @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@ 341 354 342 355 .c.o: … … 559 572 560 573 561 bench :574 bench$(EXEEXT) : 562 575 @for ccflags in "-debug" "-nodebug"; do \ 563 576 echo ${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -lrt bench.c;\ … … 567 580 rm -f ./a.out ; 568 581 569 ctxswitch-coroutine :582 ctxswitch-coroutine$(EXEEXT): 570 583 ${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -DN=10000000 CorCtxSwitch.c 571 584 @for number in 1 2 3 4 5 6 7 8 9 10; do \ … … 574 587 @rm -f ./a.out 575 588 576 ctxswitch-thread :589 ctxswitch-thread$(EXEEXT): 577 590 ${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -DN=10000000 ThrdCtxSwitch.c 578 591 @for number in 1 2 3 4 5 6 7 8 9 10; do \ … … 581 594 @rm -f ./a.out 582 595 583 sched-int :596 sched-int$(EXEEXT): 584 597 ${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -DN=10000000 SchedInt.c 585 598 @for number in 1 2 3 4 5 6 7 8 9 10; do \ … … 588 601 @rm -f ./a.out 589 602 590 monitor :603 monitor$(EXEEXT): 591 604 ${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -DN=10000000 Monitor.c 592 605 @for number in 1 2 3 4 5 6 7 8 9 10; do \ … … 595 608 @rm -f ./a.out 596 609 597 csv-data :610 csv-data$(EXEEXT): 598 611 @${CC} ${AM_CFLAGS} ${CFLAGS} ${ccflags} @CFA_FLAGS@ -nodebug -lrt -quiet -DN=10000000 csv-data.c 599 612 @./a.out -
src/include/assert.h
rf2b12406 rf73f5f4 15 15 16 16 #pragma once 17 // Pragmas for header cleanup tool 18 // IWYU pragma: private, include <cassert> 17 19 18 20 #include_next <assert.h> -
src/libcfa/exception.c
rf2b12406 rf73f5f4 10 10 // Created On : Mon Jun 26 15:13:00 2017 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Mon Nov 26 15:11:00 201713 // Update Count : 012 // Last Modified On : Tus Jul 11 16:36:00 2017 13 // Update Count : 1 14 14 // 15 15 … … 44 44 // RESUMPTION ================================================================ 45 45 46 void __cfaehm__throw_resum ption(exception * except) {46 void __cfaehm__throw_resume(exception * except) { 47 47 48 48 // DEBUG … … 65 65 66 66 // Fall back to termination: 67 __cfaehm__throw_terminat ion(except);67 __cfaehm__throw_terminate(except); 68 68 // TODO: Default handler for resumption. 69 69 } … … 111 111 } 112 112 113 void __cfaehm__throw_terminat ion( exception * val ) {113 void __cfaehm__throw_terminate( exception * val ) { 114 114 // Store the current exception 115 115 shared_stack.current_exception = *val; … … 147 147 148 148 // Nesting this the other way would probably be faster. 149 void __cfaehm__rethrow_terminat ion(void) {149 void __cfaehm__rethrow_terminate(void) { 150 150 // DEBUG 151 151 printf("Rethrowing termination exception\n"); 152 152 153 __cfaehm__throw_terminat ion(&shared_stack.current_exception);153 __cfaehm__throw_terminate(&shared_stack.current_exception); 154 154 } 155 155 -
src/libcfa/exception.h
rf2b12406 rf73f5f4 10 10 // Created On : Mon Jun 26 15:11:00 2017 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Mon Nov 26 15:11:00 201713 // Update Count : 012 // Last Modified On : Tus Jul 11 16:31:00 2017 13 // Update Count : 2 14 14 // 15 15 … … 22 22 23 23 #ifdef __CFORALL__ 24 extern " BuiltinC" {24 extern "C" { 25 25 #endif 26 26 27 27 // Used in throw statement translation. 28 void __cfaehm__throw_terminat ion(exception * except) __attribute__((noreturn));29 void __cfaehm__rethrow_terminat ion() __attribute__((noreturn));30 void __cfaehm__throw_resum ption(exception * except);28 void __cfaehm__throw_terminate(exception * except) __attribute__((noreturn)); 29 void __cfaehm__rethrow_terminate() __attribute__((noreturn)); 30 void __cfaehm__throw_resume(exception * except); 31 31 32 32 // Function catches termination exceptions. -
src/main.cc
rf2b12406 rf73f5f4 15 15 // 16 16 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... 51 60 52 61 using namespace std;
Note: See TracChangeset
for help on using the changeset viewer.