Changeset 4dc3b8c
- Timestamp:
- Nov 30, 2023, 6:14:20 PM (23 months ago)
- Branches:
- master
- Children:
- 2f8d351
- Parents:
- 7f2bfb7 (diff), c4570af3 (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:
-
- 1 deleted
- 22 edited
- 21 moved
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Expr.cpp
r7f2bfb7 r4dc3b8c 222 222 } 223 223 224 MemberExpr::MemberExpr( const CodeLocation & loc, const DeclWithType * mem, const Expr * agg,225 MemberExpr::NoOpConstruction overloadSelector )226 : Expr( loc ), member( mem ), aggregate( agg ) {227 assert( member );228 assert( aggregate );229 assert( aggregate->result );230 (void) overloadSelector;231 }232 233 224 bool MemberExpr::get_lvalue() const { 234 225 // This is actually wrong by C, but it works with our current set-up. … … 388 379 stmts.emplace_back( new ExprStmt{ loc, tupleExpr } ); 389 380 stmtExpr = new StmtExpr{ loc, new CompoundStmt{ loc, std::move(stmts) } }; 390 }391 392 TupleAssignExpr::TupleAssignExpr(393 const CodeLocation & loc, const Type * result, const StmtExpr * s )394 : Expr( loc, result ), stmtExpr() {395 stmtExpr = s;396 381 } 397 382 -
src/AST/Expr.hpp
r7f2bfb7 r4dc3b8c 35 35 template<typename node_t> friend node_t * shallowCopy(const node_t * node); 36 36 37 38 class ConverterOldToNew;39 class ConverterNewToOld;40 41 37 namespace ast { 42 38 … … 439 435 MemberExpr * clone() const override { return new MemberExpr{ *this }; } 440 436 MUTATE_FRIEND 441 442 // Custructor overload meant only for AST conversion443 enum NoOpConstruction { NoOpConstructionChosen };444 MemberExpr( const CodeLocation & loc, const DeclWithType * mem, const Expr * agg,445 NoOpConstruction overloadSelector );446 friend class ::ConverterOldToNew;447 friend class ::ConverterNewToOld;448 437 }; 449 438 … … 458 447 ConstantExpr( 459 448 const CodeLocation & loc, const Type * ty, const std::string & r, 460 std::optional<unsigned long long>i )461 : Expr( loc, ty ), rep( r ), ival( i ) , underlyer(ty){}449 const std::optional<unsigned long long> & i ) 450 : Expr( loc, ty ), rep( r ), ival( i ) {} 462 451 463 452 /// Gets the integer value of this constant, if one is appropriate to its type. … … 483 472 484 473 std::optional<unsigned long long> ival; 485 486 // Intended only for legacy support of roundtripping the old AST.487 // Captures the very-locally inferred type, before the resolver modifies the type of this ConstantExpression.488 // In the old AST it's constExpr->constant.type489 ptr<Type> underlyer;490 friend class ::ConverterOldToNew;491 friend class ::ConverterNewToOld;492 474 }; 493 475 … … 779 761 const Expr * accept( Visitor & v ) const override { return v.visit( this ); } 780 762 781 friend class ::ConverterOldToNew;782 783 763 private: 784 764 TupleAssignExpr * clone() const override { return new TupleAssignExpr{ *this }; } 785 TupleAssignExpr( const CodeLocation & loc, const Type * result, const StmtExpr * s );786 787 765 MUTATE_FRIEND 788 766 }; -
src/CodeGen/CodeGenerator.cpp
r7f2bfb7 r4dc3b8c 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // CodeGenerator New.cpp --7 // CodeGenerator.cpp -- 8 8 // 9 9 // Author : Andrew Beach … … 14 14 // 15 15 16 #include "CodeGenerator New.hpp"16 #include "CodeGenerator.hpp" 17 17 18 18 #include "AST/Print.hpp" -
src/CodeGen/CodeGenerator.hpp
r7f2bfb7 r4dc3b8c 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // CodeGenerator New.hpp --7 // CodeGenerator.hpp -- 8 8 // 9 9 // Author : Andrew Beach -
src/CodeGen/GenType.cc
r7f2bfb7 r4dc3b8c 21 21 #include "AST/Print.hpp" // for print 22 22 #include "AST/Vector.hpp" // for vector 23 #include "CodeGenerator New.hpp"// for CodeGenerator23 #include "CodeGenerator.hpp" // for CodeGenerator 24 24 #include "Common/UniqueName.h" // for UniqueName 25 25 -
src/CodeGen/Generate.cc
r7f2bfb7 r4dc3b8c 19 19 #include <string> // for operator<< 20 20 21 #include "CodeGenerator New.hpp"// for CodeGenerator, doSemicolon, ...21 #include "CodeGenerator.hpp" // for CodeGenerator, doSemicolon, ... 22 22 #include "GenType.h" // for genPrettyType 23 23 -
src/CodeGen/module.mk
r7f2bfb7 r4dc3b8c 16 16 17 17 SRC_CODEGEN = \ 18 CodeGen/CodeGenerator New.cpp \19 CodeGen/CodeGenerator New.hpp \18 CodeGen/CodeGenerator.cpp \ 19 CodeGen/CodeGenerator.hpp \ 20 20 CodeGen/GenType.cc \ 21 21 CodeGen/GenType.h \ -
src/Concurrency/Keywords.cpp
r7f2bfb7 r4dc3b8c 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // Keywords New.cpp -- Implement concurrency constructs from their keywords.7 // Keywords.cpp -- Implement concurrency constructs from their keywords. 8 8 // 9 9 // Author : Andrew Beach … … 14 14 // 15 15 16 #include "Concurrency/Keywords.h" 17 16 18 #include <iostream> 17 18 #include "Concurrency/Keywords.h"19 19 20 20 #include "AST/Copy.hpp" … … 30 30 #include "Common/utility.h" 31 31 #include "Common/UniqueName.h" 32 #include "ControlStruct/LabelGenerator New.hpp"32 #include "ControlStruct/LabelGenerator.hpp" 33 33 #include "InitTweak/InitTweak.h" 34 34 #include "Virtual/Tables.h" -
src/Concurrency/Waitfor.cpp
r7f2bfb7 r4dc3b8c 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // Waitfor New.cpp -- Expand waitfor clauses into code.7 // Waitfor.cpp -- Expand waitfor clauses into code. 8 8 // 9 9 // Author : Andrew Beach -
src/Concurrency/module.mk
r7f2bfb7 r4dc3b8c 20 20 Concurrency/Corun.cpp \ 21 21 Concurrency/Corun.hpp \ 22 Concurrency/Keywords New.cpp \22 Concurrency/Keywords.cpp \ 23 23 Concurrency/Keywords.h \ 24 Concurrency/Waitfor New.cpp \24 Concurrency/Waitfor.cpp \ 25 25 Concurrency/Waitfor.h \ 26 26 Concurrency/Waituntil.cpp \ -
src/ControlStruct/ExceptDecl.cpp
r7f2bfb7 r4dc3b8c 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // ExceptDecl New.cpp --7 // ExceptDecl.cpp -- 8 8 // 9 9 // Author : Andrew Beach -
src/ControlStruct/ExceptTranslate.cpp
r7f2bfb7 r4dc3b8c 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // ExceptTranslate New.cpp -- Conversion of exception control flow structures.7 // ExceptTranslate.cpp -- Conversion of exception control flow structures. 8 8 // 9 9 // Author : Andrew Beach -
src/ControlStruct/LabelGenerator.cpp
r7f2bfb7 r4dc3b8c 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // LabelGenerator New.cpp --7 // LabelGenerator.cpp -- 8 8 // 9 9 // Author : Peter A. Buhr … … 14 14 // 15 15 16 #include "LabelGenerator New.hpp"16 #include "LabelGenerator.hpp" 17 17 18 18 #include "AST/Attribute.hpp" -
src/ControlStruct/LabelGenerator.hpp
r7f2bfb7 r4dc3b8c 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // LabelGenerator.h --7 // LabelGenerator.hpp -- 8 8 // 9 9 // Author : Rodolfo G. Esteves … … 26 26 27 27 namespace ControlStruct { 28 ast::Label newLabel( const std::string &, const ast::Stmt * ); 29 ast::Label newLabel( const std::string &, const CodeLocation & ); 28 29 ast::Label newLabel( const std::string &, const ast::Stmt * ); 30 ast::Label newLabel( const std::string &, const CodeLocation & ); 31 30 32 } // namespace ControlStruct 31 33 -
src/ControlStruct/MultiLevelExit.cpp
r7f2bfb7 r4dc3b8c 16 16 #include "MultiLevelExit.hpp" 17 17 18 #include <set> 19 18 20 #include "AST/Pass.hpp" 19 21 #include "AST/Stmt.hpp" 20 #include "LabelGeneratorNew.hpp" 21 22 #include <set> 22 #include "LabelGenerator.hpp" 23 23 24 using namespace std; 24 25 using namespace ast; -
src/ControlStruct/module.mk
r7f2bfb7 r4dc3b8c 16 16 17 17 SRC += \ 18 ControlStruct/ExceptDecl New.cpp \18 ControlStruct/ExceptDecl.cpp \ 19 19 ControlStruct/ExceptDecl.h \ 20 ControlStruct/ExceptTranslate New.cpp \20 ControlStruct/ExceptTranslate.cpp \ 21 21 ControlStruct/ExceptTranslate.h \ 22 22 ControlStruct/FixLabels.cpp \ … … 24 24 ControlStruct/HoistControlDecls.cpp \ 25 25 ControlStruct/HoistControlDecls.hpp \ 26 ControlStruct/LabelGenerator New.cpp \27 ControlStruct/LabelGenerator New.hpp \26 ControlStruct/LabelGenerator.cpp \ 27 ControlStruct/LabelGenerator.hpp \ 28 28 ControlStruct/MultiLevelExit.cpp \ 29 29 ControlStruct/MultiLevelExit.hpp -
src/GenPoly/Box.cpp
r7f2bfb7 r4dc3b8c 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // Box New.cpp -- Implement polymorphic function calls and types.7 // Box.cpp -- Implement polymorphic function calls and types. 8 8 // 9 9 // Author : Andrew Beach … … 32 32 #include "GenPoly/Lvalue.h" // for generalizedLvalue 33 33 #include "GenPoly/ScopedSet.h" // for ScopedSet 34 #include "GenPoly/ScrubTy Vars.h"// for scrubTypeVars, scrubAllTypeVars34 #include "GenPoly/ScrubTypeVars.hpp" // for scrubTypeVars, scrubAllTypeVars 35 35 #include "ResolvExpr/Unify.h" // for typesCompatible 36 36 #include "SymTab/Mangler.h" // for mangle, mangleType -
src/GenPoly/FindFunction.cc
r7f2bfb7 r4dc3b8c 22 22 #include "GenPoly/ErasableScopedMap.h" // for ErasableScopedMap<>::iterator 23 23 #include "GenPoly/GenPoly.h" // for TyVarMap 24 #include "ScrubTy Vars.h" // for ScrubTyVars24 #include "ScrubTypeVars.hpp" // for scrubTypeVars 25 25 26 26 namespace GenPoly { -
src/GenPoly/InstantiateGeneric.cpp
r7f2bfb7 r4dc3b8c 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // InstantiateGeneric New.cpp -- Create concrete instances of generic types.7 // InstantiateGeneric.cpp -- Create concrete instances of generic types. 8 8 // 9 9 // Author : Andrew Beach … … 31 31 #include "Common/UniqueName.h" // for UniqueName 32 32 #include "GenPoly/GenPoly.h" // for isPolyType, typesPolyCompatible 33 #include "GenPoly/ScrubTy Vars.h" // for scrubAll33 #include "GenPoly/ScrubTypeVars.hpp" // for scrubAllTypeVars 34 34 #include "ResolvExpr/AdjustExprType.hpp" // for adjustExprType 35 35 #include "ResolvExpr/Unify.h" // for typesCompatible -
src/GenPoly/Lvalue.cpp
r7f2bfb7 r4dc3b8c 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // Lvalue New.cpp -- Clean up lvalues and remove references.7 // Lvalue.cpp -- Clean up lvalues and remove references. 8 8 // 9 9 // Author : Andrew Beach -
src/GenPoly/ScrubTypeVars.cpp
r7f2bfb7 r4dc3b8c 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // ScrubTy Vars.cc-- Remove polymorphic types.7 // ScrubTypeVars.cpp -- Remove polymorphic types. 8 8 // 9 9 // Author : Richard C. Bilson … … 14 14 // 15 15 16 #include "ScrubTypeVars.hpp" 17 16 18 #include <utility> // for pair 17 19 … … 19 21 #include "GenPoly.h" // for mangleType, TyVarMap, alignof... 20 22 #include "GenPoly/ErasableScopedMap.h" // for ErasableScopedMap<>::const_it... 21 #include "ScrubTyVars.h"22 23 #include "SymTab/Mangler.h" // for mangleType 23 24 -
src/GenPoly/ScrubTypeVars.hpp
r7f2bfb7 r4dc3b8c 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // ScrubTy Vars.h-- Remove polymorphic types.7 // ScrubTypeVars.hpp -- Remove polymorphic types. 8 8 // 9 9 // Author : Richard C. Bilson -
src/GenPoly/Specialize.cpp
r7f2bfb7 r4dc3b8c 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // Specialize New.cpp -- Generate thunks to specialize polymorphic functions.7 // Specialize.cpp -- Generate thunks to specialize polymorphic functions. 8 8 // 9 9 // Author : Andrew Beach -
src/GenPoly/module.mk
r7f2bfb7 r4dc3b8c 22 22 23 23 SRC += $(SRC_GENPOLY) \ 24 GenPoly/Box New.cpp \24 GenPoly/Box.cpp \ 25 25 GenPoly/Box.h \ 26 26 GenPoly/ErasableScopedMap.h \ 27 27 GenPoly/FindFunction.cc \ 28 28 GenPoly/FindFunction.h \ 29 GenPoly/InstantiateGeneric New.cpp \29 GenPoly/InstantiateGeneric.cpp \ 30 30 GenPoly/InstantiateGeneric.h \ 31 GenPoly/Lvalue New.cpp \31 GenPoly/Lvalue.cpp \ 32 32 GenPoly/ScopedSet.h \ 33 GenPoly/ScrubTy Vars.cc\34 GenPoly/ScrubTy Vars.h\35 GenPoly/Specialize New.cpp \33 GenPoly/ScrubTypeVars.cpp \ 34 GenPoly/ScrubTypeVars.hpp \ 35 GenPoly/Specialize.cpp \ 36 36 GenPoly/Specialize.h 37 37 -
src/InitTweak/module.mk
r7f2bfb7 r4dc3b8c 24 24 InitTweak/FixGlobalInit.cc \ 25 25 InitTweak/FixGlobalInit.h \ 26 InitTweak/FixInit. h\27 InitTweak/FixInit New.cpp26 InitTweak/FixInit.cpp \ 27 InitTweak/FixInit.h 28 28 29 29 SRCDEMANGLE += $(SRC_INITTWEAK) -
src/MakeLibCfa.cpp
r7f2bfb7 r4dc3b8c 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // MakeLibCfa New.cpp --7 // MakeLibCfa.cpp -- 8 8 // 9 9 // Author : Henry Xue -
src/Makefile.am
r7f2bfb7 r4dc3b8c 22 22 CompilationState.cc \ 23 23 CompilationState.h \ 24 MakeLibCfa New.cpp \24 MakeLibCfa.cpp \ 25 25 MakeLibCfa.h 26 26 -
src/ResolvExpr/CandidateFinder.cpp
r7f2bfb7 r4dc3b8c 105 105 106 106 // CandidateFinder finder{ symtab, env }; 107 // finder.find( arg, Resolv Mode::withAdjustment() );107 // finder.find( arg, ResolveMode::withAdjustment() ); 108 108 // assertf( finder.candidates.size() > 0, 109 109 // "Somehow castable expression failed to find alternatives." ); … … 974 974 // xxx - is it possible that handleTupleAssignment and main finder both produce candidates? 975 975 // this means there exists ctor/assign functions with a tuple as first parameter. 976 Resolv Mode mode = {976 ResolveMode mode = { 977 977 true, // adjust 978 978 !untypedExpr->func.as<ast::NameExpr>(), // prune if not calling by name … … 989 989 CandidateFinder opFinder( context, tenv ); 990 990 // okay if there aren't any function operations 991 opFinder.find( opExpr, Resolv Mode::withoutFailFast() );991 opFinder.find( opExpr, ResolveMode::withoutFailFast() ); 992 992 PRINT( 993 993 std::cerr << "known function ops:" << std::endl; … … 1175 1175 if ( castExpr->kind == ast::CastExpr::Return ) { 1176 1176 finder.strictMode = true; 1177 finder.find( castExpr->arg, Resolv Mode::withAdjustment() );1177 finder.find( castExpr->arg, ResolveMode::withAdjustment() ); 1178 1178 1179 1179 // return casts are eliminated (merely selecting an overload, no actual operation) 1180 1180 candidates = std::move(finder.candidates); 1181 1181 } 1182 finder.find( castExpr->arg, Resolv Mode::withAdjustment() );1182 finder.find( castExpr->arg, ResolveMode::withAdjustment() ); 1183 1183 1184 1184 if ( !finder.candidates.empty() ) reason.code = NoMatch; … … 1251 1251 CandidateFinder finder( context, tenv ); 1252 1252 // don't prune here, all alternatives guaranteed to have same type 1253 finder.find( castExpr->arg, Resolv Mode::withoutPrune() );1253 finder.find( castExpr->arg, ResolveMode::withoutPrune() ); 1254 1254 for ( CandidateRef & r : finder.candidates ) { 1255 1255 addCandidate( … … 1298 1298 1299 1299 // don't prune here, since it's guaranteed all alternatives will have the same type 1300 finder.find( tech1.get(), Resolv Mode::withoutPrune() );1300 finder.find( tech1.get(), ResolveMode::withoutPrune() ); 1301 1301 pick_alternatives(finder.candidates, false); 1302 1302 … … 1307 1307 std::unique_ptr<const ast::Expr> fallback { ast::UntypedExpr::createDeref(loc, new ast::UntypedExpr(loc, new ast::NameExpr(loc, castExpr->concrete_target.getter), { castExpr->arg })) }; 1308 1308 // don't prune here, since it's guaranteed all alternatives will have the same type 1309 finder.find( fallback.get(), Resolv Mode::withoutPrune() );1309 finder.find( fallback.get(), ResolveMode::withoutPrune() ); 1310 1310 1311 1311 pick_alternatives(finder.candidates, true); … … 1316 1316 void Finder::postvisit( const ast::UntypedMemberExpr * memberExpr ) { 1317 1317 CandidateFinder aggFinder( context, tenv ); 1318 aggFinder.find( memberExpr->aggregate, Resolv Mode::withAdjustment() );1318 aggFinder.find( memberExpr->aggregate, ResolveMode::withAdjustment() ); 1319 1319 for ( CandidateRef & agg : aggFinder.candidates ) { 1320 1320 // it's okay for the aggregate expression to have reference type -- cast it to the … … 1475 1475 void Finder::postvisit( const ast::LogicalExpr * logicalExpr ) { 1476 1476 CandidateFinder finder1( context, tenv ); 1477 finder1.find( logicalExpr->arg1, Resolv Mode::withAdjustment() );1477 finder1.find( logicalExpr->arg1, ResolveMode::withAdjustment() ); 1478 1478 if ( finder1.candidates.empty() ) return; 1479 1479 1480 1480 CandidateFinder finder2( context, tenv ); 1481 finder2.find( logicalExpr->arg2, Resolv Mode::withAdjustment() );1481 finder2.find( logicalExpr->arg2, ResolveMode::withAdjustment() ); 1482 1482 if ( finder2.candidates.empty() ) return; 1483 1483 … … 1505 1505 // candidates for condition 1506 1506 CandidateFinder finder1( context, tenv ); 1507 finder1.find( conditionalExpr->arg1, Resolv Mode::withAdjustment() );1507 finder1.find( conditionalExpr->arg1, ResolveMode::withAdjustment() ); 1508 1508 if ( finder1.candidates.empty() ) return; 1509 1509 … … 1511 1511 CandidateFinder finder2( context, tenv ); 1512 1512 finder2.allowVoid = true; 1513 finder2.find( conditionalExpr->arg2, Resolv Mode::withAdjustment() );1513 finder2.find( conditionalExpr->arg2, ResolveMode::withAdjustment() ); 1514 1514 if ( finder2.candidates.empty() ) return; 1515 1515 … … 1517 1517 CandidateFinder finder3( context, tenv ); 1518 1518 finder3.allowVoid = true; 1519 finder3.find( conditionalExpr->arg3, Resolv Mode::withAdjustment() );1519 finder3.find( conditionalExpr->arg3, ResolveMode::withAdjustment() ); 1520 1520 if ( finder3.candidates.empty() ) return; 1521 1521 … … 1570 1570 1571 1571 CandidateFinder finder2( context, env ); 1572 finder2.find( commaExpr->arg2, Resolv Mode::withAdjustment() );1572 finder2.find( commaExpr->arg2, ResolveMode::withAdjustment() ); 1573 1573 1574 1574 for ( const CandidateRef & r2 : finder2.candidates ) { … … 1584 1584 CandidateFinder finder( context, tenv ); 1585 1585 finder.allowVoid = true; 1586 finder.find( ctorExpr->callExpr, Resolv Mode::withoutPrune() );1586 finder.find( ctorExpr->callExpr, ResolveMode::withoutPrune() ); 1587 1587 for ( CandidateRef & r : finder.candidates ) { 1588 1588 addCandidate( *r, new ast::ConstructorExpr{ ctorExpr->location, r->expr } ); … … 1593 1593 // resolve low and high, accept candidates where low and high types unify 1594 1594 CandidateFinder finder1( context, tenv ); 1595 finder1.find( rangeExpr->low, Resolv Mode::withAdjustment() );1595 finder1.find( rangeExpr->low, ResolveMode::withAdjustment() ); 1596 1596 if ( finder1.candidates.empty() ) return; 1597 1597 1598 1598 CandidateFinder finder2( context, tenv ); 1599 finder2.find( rangeExpr->high, Resolv Mode::withAdjustment() );1599 finder2.find( rangeExpr->high, ResolveMode::withAdjustment() ); 1600 1600 if ( finder2.candidates.empty() ) return; 1601 1601 … … 1673 1673 void Finder::postvisit( const ast::UniqueExpr * unqExpr ) { 1674 1674 CandidateFinder finder( context, tenv ); 1675 finder.find( unqExpr->expr, Resolv Mode::withAdjustment() );1675 finder.find( unqExpr->expr, ResolveMode::withAdjustment() ); 1676 1676 for ( CandidateRef & r : finder.candidates ) { 1677 1677 // ensure that the the id is passed on so that the expressions are "linked" … … 1699 1699 // only open for the duration of resolving the UntypedExpr. 1700 1700 CandidateFinder finder( context, tenv, toType ); 1701 finder.find( initExpr->expr, Resolv Mode::withAdjustment() );1701 finder.find( initExpr->expr, ResolveMode::withAdjustment() ); 1702 1702 1703 1703 Cost minExprCost = Cost::infinity; … … 1889 1889 } 1890 1890 1891 void CandidateFinder::find( const ast::Expr * expr, Resolv Mode mode ) {1891 void CandidateFinder::find( const ast::Expr * expr, ResolveMode mode ) { 1892 1892 // Find alternatives for expression 1893 1893 ast::Pass<Finder> finder{ *this }; … … 2004 2004 for ( const auto & x : xs ) { 2005 2005 out.emplace_back( context, env ); 2006 out.back().find( x, Resolv Mode::withAdjustment() );2006 out.back().find( x, ResolveMode::withAdjustment() ); 2007 2007 2008 2008 PRINT( -
src/ResolvExpr/CandidateFinder.hpp
r7f2bfb7 r4dc3b8c 17 17 18 18 #include "Candidate.hpp" 19 #include "Resolv Mode.h"19 #include "ResolveMode.hpp" 20 20 #include "AST/Fwd.hpp" 21 21 #include "AST/Node.hpp" … … 43 43 44 44 /// Fill candidates with feasible resolutions for `expr` 45 void find( const ast::Expr * expr, Resolv Mode mode = {} );45 void find( const ast::Expr * expr, ResolveMode mode = {} ); 46 46 bool pruneCandidates( CandidateList & candidates, CandidateList & out, std::vector<std::string> & errors ); 47 47 -
src/ResolvExpr/CandidatePrinter.cpp
r7f2bfb7 r4dc3b8c 16 16 #include "CandidatePrinter.hpp" 17 17 18 #include <iostream> 19 18 20 #include "AST/Expr.hpp" 19 21 #include "AST/Pass.hpp" … … 23 25 #include "ResolvExpr/CandidateFinder.hpp" 24 26 #include "ResolvExpr/Resolver.h" 25 26 #include <iostream>27 27 28 28 namespace ResolvExpr { … … 39 39 ast::TypeEnvironment env; 40 40 CandidateFinder finder( { symtab, transUnit().global }, env ); 41 finder.find( stmt->expr, Resolv Mode::withAdjustment() );41 finder.find( stmt->expr, ResolveMode::withAdjustment() ); 42 42 int count = 1; 43 43 os << "There are " << finder.candidates.size() << " candidates\n"; -
src/ResolvExpr/ResolveMode.hpp
r7f2bfb7 r4dc3b8c 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // Resolv Mode.h--7 // ResolveMode.hpp -- 8 8 // 9 9 // Author : Aaron B. Moss … … 19 19 20 20 /// Flag set for resolution 21 struct Resolv Mode {21 struct ResolveMode { 22 22 const bool adjust; ///< Adjust array and function types to pointer types? [false] 23 23 const bool prune; ///< Prune alternatives to min-cost per return type? [true] 24 24 const bool failFast; ///< Fail on no resulting alternatives? [true] 25 25 26 constexpr Resolv Mode(bool a, bool p, bool ff)26 constexpr ResolveMode(bool a, bool p, bool ff) 27 27 : adjust(a), prune(p), failFast(ff) {} 28 28 29 29 /// Default settings 30 constexpr Resolv Mode() : adjust(false), prune(true), failFast(true) {}30 constexpr ResolveMode() : adjust(false), prune(true), failFast(true) {} 31 31 32 32 /// With adjust flag set; turns array and function types into equivalent pointers 33 static constexpr Resolv Mode withAdjustment() { return { true, true, true }; }33 static constexpr ResolveMode withAdjustment() { return { true, true, true }; } 34 34 35 35 /// With adjust flag set but prune unset; pruning ensures there is at least one alternative 36 36 /// per result type 37 static constexpr Resolv Mode withoutPrune() { return { true, false, true }; }37 static constexpr ResolveMode withoutPrune() { return { true, false, true }; } 38 38 39 39 /// With adjust and prune flags set but failFast unset; failFast ensures there is at least 40 40 /// one resulting alternative 41 static constexpr Resolv Mode withoutFailFast() { return { true, true, false }; }41 static constexpr ResolveMode withoutFailFast() { return { true, true, false }; } 42 42 43 43 /// The same mode, but with satisfyAssns turned on; for top-level calls 44 Resolv Mode atTopLevel() const { return { adjust, true, failFast }; }44 ResolveMode atTopLevel() const { return { adjust, true, failFast }; } 45 45 }; 46 46 -
src/ResolvExpr/Resolver.cc
r7f2bfb7 r4dc3b8c 25 25 #include "Resolver.h" 26 26 #include "ResolveTypeof.h" 27 #include "Resolv Mode.h" // for ResolvMode27 #include "ResolveMode.hpp" // for ResolveMode 28 28 #include "typeops.h" // for extractResultType 29 29 #include "Unify.h" // for unify … … 123 123 CandidateRef findUnfinishedKindExpression( 124 124 const ast::Expr * untyped, const ResolveContext & context, const std::string & kind, 125 std::function<bool(const Candidate &)> pred = anyCandidate, Resolv Mode mode = {}125 std::function<bool(const Candidate &)> pred = anyCandidate, ResolveMode mode = {} 126 126 ) { 127 127 if ( ! untyped ) return nullptr; … … 263 263 ast::ptr< ast::CastExpr > untyped = new ast::CastExpr{ expr }; 264 264 CandidateRef choice = findUnfinishedKindExpression( 265 untyped, context, "", anyCandidate, Resolv Mode::withAdjustment() );265 untyped, context, "", anyCandidate, ResolveMode::withAdjustment() ); 266 266 267 267 // a cast expression has either 0 or 1 interpretations (by language rules); … … 292 292 const ast::Expr * untyped, const ResolveContext & context, 293 293 std::function<bool(const Candidate &)> pred = anyCandidate, 294 const std::string & kind = "", Resolv Mode mode = {}294 const std::string & kind = "", ResolveMode mode = {} 295 295 ) { 296 296 if ( ! untyped ) return {}; … … 860 860 861 861 // Find all candidates for a function in canonical form 862 funcFinder.find( clause.target, Resolv Mode::withAdjustment() );862 funcFinder.find( clause.target, ResolveMode::withAdjustment() ); 863 863 864 864 if ( funcFinder.candidates.empty() ) { -
src/ResolvExpr/module.mk
r7f2bfb7 r4dc3b8c 47 47 ResolvExpr/ResolveTypeof.cc \ 48 48 ResolvExpr/ResolveTypeof.h \ 49 ResolvExpr/Resolv Mode.h\49 ResolvExpr/ResolveMode.hpp \ 50 50 ResolvExpr/SatisfyAssertions.cpp \ 51 51 ResolvExpr/SatisfyAssertions.hpp \ -
src/Tuples/TupleAssignment.cc
r7f2bfb7 r4dc3b8c 13 13 // Update Count : 10 14 14 // 15 16 #include "Tuples.h" 15 17 16 18 #include <algorithm> // for transform … … 224 226 // by the cast type as needed, and transfer the resulting environment. 225 227 ResolvExpr::CandidateFinder finder( spotter.crntFinder.context, env ); 226 finder.find( rhsCand->expr, ResolvExpr::Resolv Mode::withAdjustment() );228 finder.find( rhsCand->expr, ResolvExpr::ResolveMode::withAdjustment() ); 227 229 assert( 1 == finder.candidates.size() ); 228 230 env = std::move( finder.candidates.front()->env ); … … 345 347 346 348 try { 347 finder.find( expr, ResolvExpr::Resolv Mode::withAdjustment() );349 finder.find( expr, ResolvExpr::ResolveMode::withAdjustment() ); 348 350 } catch (...) { 349 351 // No match is not failure, just that this tuple assignment is invalid. -
src/Tuples/TupleExpansion.cpp
r7f2bfb7 r4dc3b8c 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // TupleExpansion New.cpp --7 // TupleExpansion.cpp -- 8 8 // 9 9 // Author : Henry Xue … … 294 294 } 295 295 296 const ast::Type * makeTupleType( const std::vector<ast::ptr<ast::Expr>> & exprs ) { 297 // If there are no expressions, the answer is set, otherwise go through a loop. 298 if ( exprs.empty() ) return new ast::TupleType( {} ); 299 300 std::vector<ast::ptr<ast::Type>> types; 301 ast::CV::Qualifiers quals( 302 ast::CV::Const | ast::CV::Volatile | ast::CV::Restrict | 303 ast::CV::Atomic | ast::CV::Mutex ); 304 305 for ( const ast::Expr * expr : exprs ) { 306 assert( expr->result ); 307 // If the type of any expr is void, the type of the entire tuple is void. 308 if ( expr->result->isVoid() ) return new ast::VoidType(); 309 310 // Qualifiers on the tuple type are the qualifiers that exist on all components. 311 quals &= expr->result->qualifiers; 312 313 types.emplace_back( expr->result ); 314 } 315 316 return new ast::TupleType( std::move( types ), quals ); 317 } 318 319 const ast::TypeInstType * isTtype( const ast::Type * type ) { 320 if ( const ast::TypeInstType * inst = dynamic_cast< const ast::TypeInstType * >( type ) ) { 321 if ( inst->base && inst->base->kind == ast::TypeDecl::Ttype ) { 322 return inst; 323 } 324 } 325 return nullptr; 326 } 327 296 328 } // namespace Tuples 329 -
src/Tuples/module.mk
r7f2bfb7 r4dc3b8c 19 19 Tuples/Explode.h \ 20 20 Tuples/TupleAssignment.cc \ 21 Tuples/TupleExpansion.cc \ 22 Tuples/TupleExpansionNew.cpp \ 21 Tuples/TupleExpansion.cpp \ 23 22 Tuples/Tuples.cc \ 24 23 Tuples/Tuples.h -
src/Validate/FindSpecialDecls.cpp
r7f2bfb7 r4dc3b8c 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // FindSpecialDecls New.cpp -- Find special declarations used in the compiler.7 // FindSpecialDecls.cpp -- Find special declarations used in the compiler. 8 8 // 9 9 // Author : Andrew Beach -
src/Validate/FixReturnTypes.cpp
r7f2bfb7 r4dc3b8c 19 19 #include "AST/Pass.hpp" 20 20 #include "AST/Type.hpp" 21 #include "CodeGen/CodeGenerator New.hpp"21 #include "CodeGen/CodeGenerator.hpp" 22 22 #include "ResolvExpr/Unify.h" 23 24 namespace ast {25 class TranslationUnit;26 }27 23 28 24 namespace Validate { -
src/Validate/LinkInstanceTypes.cpp
r7f2bfb7 r4dc3b8c 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // Link ReferenceToTypes.cpp -- Connect instance types to declarations.7 // LinkInstanceTypes.cpp -- Connect instance types to declarations. 8 8 // 9 9 // Author : Andrew Beach … … 14 14 // 15 15 16 #include "Validate/Link ReferenceToTypes.hpp"16 #include "Validate/LinkInstanceTypes.hpp" 17 17 18 18 #include "AST/Pass.hpp" … … 331 331 } // namespace 332 332 333 void link ReferenceToTypes( ast::TranslationUnit & translationUnit ) {333 void linkInstanceTypes( ast::TranslationUnit & translationUnit ) { 334 334 ast::Pass<LinkTypesCore>::run( translationUnit ); 335 335 } -
src/Validate/LinkInstanceTypes.hpp
r7f2bfb7 r4dc3b8c 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // Link ReferenceToTypes.hpp -- Connect instance types to declarations.7 // LinkInstanceTypes.hpp -- Connect instance types to declarations. 8 8 // 9 9 // Author : Andrew Beach … … 25 25 /// adjustments, such as setting the sized flag. 26 26 /// Because of the sized flag, it must happen before auto-gen. 27 void link ReferenceToTypes( ast::TranslationUnit & translationUnit );27 void linkInstanceTypes( ast::TranslationUnit & translationUnit ); 28 28 29 29 } -
src/Validate/module.mk
r7f2bfb7 r4dc3b8c 27 27 Validate/EnumAndPointerDecay.cpp \ 28 28 Validate/EnumAndPointerDecay.hpp \ 29 Validate/FindSpecialDecls New.cpp \29 Validate/FindSpecialDecls.cpp \ 30 30 Validate/FixQualifiedTypes.cpp \ 31 31 Validate/FixQualifiedTypes.hpp \ … … 44 44 Validate/LabelAddressFixer.cpp \ 45 45 Validate/LabelAddressFixer.hpp \ 46 Validate/Link ReferenceToTypes.cpp \47 Validate/Link ReferenceToTypes.hpp \46 Validate/LinkInstanceTypes.cpp \ 47 Validate/LinkInstanceTypes.hpp \ 48 48 Validate/NoIdSymbolTable.hpp \ 49 49 Validate/ReplaceTypedef.cpp \ -
src/main.cc
r7f2bfb7 r4dc3b8c 78 78 #include "Validate/InitializerLength.hpp" // for setLengthFromInitializer 79 79 #include "Validate/LabelAddressFixer.hpp" // for fixLabelAddresses 80 #include "Validate/Link ReferenceToTypes.hpp" // for linkReferenceToTypes80 #include "Validate/LinkInstanceTypes.hpp" // for linkInstanceTypes 81 81 #include "Validate/ReplaceTypedef.hpp" // for replaceTypedef 82 82 #include "Validate/ReturnCheck.hpp" // for checkReturnStatements 83 83 #include "Validate/VerifyCtorDtorAssign.hpp" // for verifyCtorDtorAssign 84 84 #include "Virtual/ExpandCasts.h" // for expandCasts 85 #include "Virtual/VirtualDtor.hpp" 85 #include "Virtual/VirtualDtor.hpp" // for implementVirtDtors 86 86 87 87 using namespace std; … … 318 318 PASS( "Enum and Pointer Decay", Validate::decayEnumsAndPointers, transUnit ); 319 319 320 PASS( "Link Reference To Types", Validate::linkReferenceToTypes, transUnit );320 PASS( "Link Instance Types", Validate::linkInstanceTypes, transUnit ); 321 321 322 322 PASS( "Forall Pointer Decay", Validate::decayForallPointers, transUnit );
Note:
See TracChangeset
for help on using the changeset viewer.