Changeset 4dc3b8c


Ignore:
Timestamp:
Nov 30, 2023, 6:14:20 PM (23 months ago)
Author:
Peter A. Buhr <pabuhr@…>
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.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

Location:
src
Files:
1 deleted
22 edited
21 moved

Legend:

Unmodified
Added
Removed
  • src/AST/Expr.cpp

    r7f2bfb7 r4dc3b8c  
    222222}
    223223
    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 
    233224bool MemberExpr::get_lvalue() const {
    234225        // This is actually wrong by C, but it works with our current set-up.
     
    388379        stmts.emplace_back( new ExprStmt{ loc, tupleExpr } );
    389380        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;
    396381}
    397382
  • src/AST/Expr.hpp

    r7f2bfb7 r4dc3b8c  
    3535        template<typename node_t> friend node_t * shallowCopy(const node_t * node);
    3636
    37 
    38 class ConverterOldToNew;
    39 class ConverterNewToOld;
    40 
    4137namespace ast {
    4238
     
    439435        MemberExpr * clone() const override { return new MemberExpr{ *this }; }
    440436        MUTATE_FRIEND
    441 
    442         // Custructor overload meant only for AST conversion
    443         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;
    448437};
    449438
     
    458447        ConstantExpr(
    459448                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 ) {}
    462451
    463452        /// Gets the integer value of this constant, if one is appropriate to its type.
     
    483472
    484473        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.type
    489         ptr<Type> underlyer;
    490         friend class ::ConverterOldToNew;
    491         friend class ::ConverterNewToOld;
    492474};
    493475
     
    779761        const Expr * accept( Visitor & v ) const override { return v.visit( this ); }
    780762
    781         friend class ::ConverterOldToNew;
    782 
    783763private:
    784764        TupleAssignExpr * clone() const override { return new TupleAssignExpr{ *this }; }
    785     TupleAssignExpr( const CodeLocation & loc, const Type * result, const StmtExpr * s );
    786 
    787765        MUTATE_FRIEND
    788766};
  • src/CodeGen/CodeGenerator.cpp

    r7f2bfb7 r4dc3b8c  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // CodeGeneratorNew.cpp --
     7// CodeGenerator.cpp --
    88//
    99// Author           : Andrew Beach
     
    1414//
    1515
    16 #include "CodeGeneratorNew.hpp"
     16#include "CodeGenerator.hpp"
    1717
    1818#include "AST/Print.hpp"
  • src/CodeGen/CodeGenerator.hpp

    r7f2bfb7 r4dc3b8c  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // CodeGeneratorNew.hpp --
     7// CodeGenerator.hpp --
    88//
    99// Author           : Andrew Beach
  • src/CodeGen/GenType.cc

    r7f2bfb7 r4dc3b8c  
    2121#include "AST/Print.hpp"          // for print
    2222#include "AST/Vector.hpp"         // for vector
    23 #include "CodeGeneratorNew.hpp"   // for CodeGenerator
     23#include "CodeGenerator.hpp"      // for CodeGenerator
    2424#include "Common/UniqueName.h"    // for UniqueName
    2525
  • src/CodeGen/Generate.cc

    r7f2bfb7 r4dc3b8c  
    1919#include <string>                    // for operator<<
    2020
    21 #include "CodeGeneratorNew.hpp"      // for CodeGenerator, doSemicolon, ...
     21#include "CodeGenerator.hpp"         // for CodeGenerator, doSemicolon, ...
    2222#include "GenType.h"                 // for genPrettyType
    2323
  • src/CodeGen/module.mk

    r7f2bfb7 r4dc3b8c  
    1616
    1717SRC_CODEGEN = \
    18         CodeGen/CodeGeneratorNew.cpp \
    19         CodeGen/CodeGeneratorNew.hpp \
     18        CodeGen/CodeGenerator.cpp \
     19        CodeGen/CodeGenerator.hpp \
    2020        CodeGen/GenType.cc \
    2121        CodeGen/GenType.h \
  • src/Concurrency/Keywords.cpp

    r7f2bfb7 r4dc3b8c  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // KeywordsNew.cpp -- Implement concurrency constructs from their keywords.
     7// Keywords.cpp -- Implement concurrency constructs from their keywords.
    88//
    99// Author           : Andrew Beach
     
    1414//
    1515
     16#include "Concurrency/Keywords.h"
     17
    1618#include <iostream>
    17 
    18 #include "Concurrency/Keywords.h"
    1919
    2020#include "AST/Copy.hpp"
     
    3030#include "Common/utility.h"
    3131#include "Common/UniqueName.h"
    32 #include "ControlStruct/LabelGeneratorNew.hpp"
     32#include "ControlStruct/LabelGenerator.hpp"
    3333#include "InitTweak/InitTweak.h"
    3434#include "Virtual/Tables.h"
  • src/Concurrency/Waitfor.cpp

    r7f2bfb7 r4dc3b8c  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // WaitforNew.cpp -- Expand waitfor clauses into code.
     7// Waitfor.cpp -- Expand waitfor clauses into code.
    88//
    99// Author           : Andrew Beach
  • src/Concurrency/module.mk

    r7f2bfb7 r4dc3b8c  
    2020        Concurrency/Corun.cpp \
    2121        Concurrency/Corun.hpp \
    22         Concurrency/KeywordsNew.cpp \
     22        Concurrency/Keywords.cpp \
    2323        Concurrency/Keywords.h \
    24         Concurrency/WaitforNew.cpp \
     24        Concurrency/Waitfor.cpp \
    2525        Concurrency/Waitfor.h \
    2626        Concurrency/Waituntil.cpp \
  • src/ControlStruct/ExceptDecl.cpp

    r7f2bfb7 r4dc3b8c  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // ExceptDeclNew.cpp --
     7// ExceptDecl.cpp --
    88//
    99// Author           : Andrew Beach
  • src/ControlStruct/ExceptTranslate.cpp

    r7f2bfb7 r4dc3b8c  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // ExceptTranslateNew.cpp -- Conversion of exception control flow structures.
     7// ExceptTranslate.cpp -- Conversion of exception control flow structures.
    88//
    99// Author           : Andrew Beach
  • src/ControlStruct/LabelGenerator.cpp

    r7f2bfb7 r4dc3b8c  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // LabelGeneratorNew.cpp --
     7// LabelGenerator.cpp --
    88//
    99// Author           : Peter A. Buhr
     
    1414//
    1515
    16 #include "LabelGeneratorNew.hpp"
     16#include "LabelGenerator.hpp"
    1717
    1818#include "AST/Attribute.hpp"
  • src/ControlStruct/LabelGenerator.hpp

    r7f2bfb7 r4dc3b8c  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // LabelGenerator.h --
     7// LabelGenerator.hpp --
    88//
    99// Author           : Rodolfo G. Esteves
     
    2626
    2727namespace ControlStruct {
    28         ast::Label newLabel( const std::string &, const ast::Stmt * );
    29         ast::Label newLabel( const std::string &, const CodeLocation & );
     28
     29ast::Label newLabel( const std::string &, const ast::Stmt * );
     30ast::Label newLabel( const std::string &, const CodeLocation & );
     31
    3032} // namespace ControlStruct
    3133
  • src/ControlStruct/MultiLevelExit.cpp

    r7f2bfb7 r4dc3b8c  
    1616#include "MultiLevelExit.hpp"
    1717
     18#include <set>
     19
    1820#include "AST/Pass.hpp"
    1921#include "AST/Stmt.hpp"
    20 #include "LabelGeneratorNew.hpp"
    21 
    22 #include <set>
     22#include "LabelGenerator.hpp"
     23
    2324using namespace std;
    2425using namespace ast;
  • src/ControlStruct/module.mk

    r7f2bfb7 r4dc3b8c  
    1616
    1717SRC += \
    18         ControlStruct/ExceptDeclNew.cpp \
     18        ControlStruct/ExceptDecl.cpp \
    1919        ControlStruct/ExceptDecl.h \
    20         ControlStruct/ExceptTranslateNew.cpp \
     20        ControlStruct/ExceptTranslate.cpp \
    2121        ControlStruct/ExceptTranslate.h \
    2222        ControlStruct/FixLabels.cpp \
     
    2424        ControlStruct/HoistControlDecls.cpp \
    2525        ControlStruct/HoistControlDecls.hpp \
    26         ControlStruct/LabelGeneratorNew.cpp \
    27         ControlStruct/LabelGeneratorNew.hpp \
     26        ControlStruct/LabelGenerator.cpp \
     27        ControlStruct/LabelGenerator.hpp \
    2828        ControlStruct/MultiLevelExit.cpp \
    2929        ControlStruct/MultiLevelExit.hpp
  • src/GenPoly/Box.cpp

    r7f2bfb7 r4dc3b8c  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // BoxNew.cpp -- Implement polymorphic function calls and types.
     7// Box.cpp -- Implement polymorphic function calls and types.
    88//
    99// Author           : Andrew Beach
     
    3232#include "GenPoly/Lvalue.h"            // for generalizedLvalue
    3333#include "GenPoly/ScopedSet.h"         // for ScopedSet
    34 #include "GenPoly/ScrubTyVars.h"       // for scrubTypeVars, scrubAllTypeVars
     34#include "GenPoly/ScrubTypeVars.hpp"   // for scrubTypeVars, scrubAllTypeVars
    3535#include "ResolvExpr/Unify.h"          // for typesCompatible
    3636#include "SymTab/Mangler.h"            // for mangle, mangleType
  • src/GenPoly/FindFunction.cc

    r7f2bfb7 r4dc3b8c  
    2222#include "GenPoly/ErasableScopedMap.h"  // for ErasableScopedMap<>::iterator
    2323#include "GenPoly/GenPoly.h"            // for TyVarMap
    24 #include "ScrubTyVars.h"                // for ScrubTyVars
     24#include "ScrubTypeVars.hpp"            // for scrubTypeVars
    2525
    2626namespace GenPoly {
  • src/GenPoly/InstantiateGeneric.cpp

    r7f2bfb7 r4dc3b8c  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // InstantiateGenericNew.cpp -- Create concrete instances of generic types.
     7// InstantiateGeneric.cpp -- Create concrete instances of generic types.
    88//
    99// Author           : Andrew Beach
     
    3131#include "Common/UniqueName.h"         // for UniqueName
    3232#include "GenPoly/GenPoly.h"           // for isPolyType, typesPolyCompatible
    33 #include "GenPoly/ScrubTyVars.h"       // for scrubAll
     33#include "GenPoly/ScrubTypeVars.hpp"   // for scrubAllTypeVars
    3434#include "ResolvExpr/AdjustExprType.hpp"  // for adjustExprType
    3535#include "ResolvExpr/Unify.h"          // for typesCompatible
  • src/GenPoly/Lvalue.cpp

    r7f2bfb7 r4dc3b8c  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // LvalueNew.cpp -- Clean up lvalues and remove references.
     7// Lvalue.cpp -- Clean up lvalues and remove references.
    88//
    99// Author           : Andrew Beach
  • src/GenPoly/ScrubTypeVars.cpp

    r7f2bfb7 r4dc3b8c  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // ScrubTyVars.cc -- Remove polymorphic types.
     7// ScrubTypeVars.cpp -- Remove polymorphic types.
    88//
    99// Author           : Richard C. Bilson
     
    1414//
    1515
     16#include "ScrubTypeVars.hpp"
     17
    1618#include <utility>                      // for pair
    1719
     
    1921#include "GenPoly.h"                    // for mangleType, TyVarMap, alignof...
    2022#include "GenPoly/ErasableScopedMap.h"  // for ErasableScopedMap<>::const_it...
    21 #include "ScrubTyVars.h"
    2223#include "SymTab/Mangler.h"             // for mangleType
    2324
  • src/GenPoly/ScrubTypeVars.hpp

    r7f2bfb7 r4dc3b8c  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // ScrubTyVars.h -- Remove polymorphic types.
     7// ScrubTypeVars.hpp -- Remove polymorphic types.
    88//
    99// Author           : Richard C. Bilson
  • src/GenPoly/Specialize.cpp

    r7f2bfb7 r4dc3b8c  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // SpecializeNew.cpp -- Generate thunks to specialize polymorphic functions.
     7// Specialize.cpp -- Generate thunks to specialize polymorphic functions.
    88//
    99// Author           : Andrew Beach
  • src/GenPoly/module.mk

    r7f2bfb7 r4dc3b8c  
    2222
    2323SRC += $(SRC_GENPOLY) \
    24         GenPoly/BoxNew.cpp \
     24        GenPoly/Box.cpp \
    2525        GenPoly/Box.h \
    2626        GenPoly/ErasableScopedMap.h \
    2727        GenPoly/FindFunction.cc \
    2828        GenPoly/FindFunction.h \
    29         GenPoly/InstantiateGenericNew.cpp \
     29        GenPoly/InstantiateGeneric.cpp \
    3030        GenPoly/InstantiateGeneric.h \
    31         GenPoly/LvalueNew.cpp \
     31        GenPoly/Lvalue.cpp \
    3232        GenPoly/ScopedSet.h \
    33         GenPoly/ScrubTyVars.cc \
    34         GenPoly/ScrubTyVars.h \
    35         GenPoly/SpecializeNew.cpp \
     33        GenPoly/ScrubTypeVars.cpp \
     34        GenPoly/ScrubTypeVars.hpp \
     35        GenPoly/Specialize.cpp \
    3636        GenPoly/Specialize.h
    3737
  • src/InitTweak/module.mk

    r7f2bfb7 r4dc3b8c  
    2424        InitTweak/FixGlobalInit.cc \
    2525        InitTweak/FixGlobalInit.h \
    26         InitTweak/FixInit.h \
    27         InitTweak/FixInitNew.cpp
     26        InitTweak/FixInit.cpp \
     27        InitTweak/FixInit.h
    2828
    2929SRCDEMANGLE += $(SRC_INITTWEAK)
  • src/MakeLibCfa.cpp

    r7f2bfb7 r4dc3b8c  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // MakeLibCfaNew.cpp --
     7// MakeLibCfa.cpp --
    88//
    99// Author           : Henry Xue
  • src/Makefile.am

    r7f2bfb7 r4dc3b8c  
    2222        CompilationState.cc \
    2323        CompilationState.h \
    24         MakeLibCfaNew.cpp \
     24        MakeLibCfa.cpp \
    2525        MakeLibCfa.h
    2626
  • src/ResolvExpr/CandidateFinder.cpp

    r7f2bfb7 r4dc3b8c  
    105105
    106106                        // CandidateFinder finder{ symtab, env };
    107                         // finder.find( arg, ResolvMode::withAdjustment() );
     107                        // finder.find( arg, ResolveMode::withAdjustment() );
    108108                        // assertf( finder.candidates.size() > 0,
    109109                        //      "Somehow castable expression failed to find alternatives." );
     
    974974                // xxx - is it possible that handleTupleAssignment and main finder both produce candidates?
    975975                // this means there exists ctor/assign functions with a tuple as first parameter.
    976                 ResolvMode mode = {
     976                ResolveMode mode = {
    977977                        true, // adjust
    978978                        !untypedExpr->func.as<ast::NameExpr>(), // prune if not calling by name
     
    989989                CandidateFinder opFinder( context, tenv );
    990990                // okay if there aren't any function operations
    991                 opFinder.find( opExpr, ResolvMode::withoutFailFast() );
     991                opFinder.find( opExpr, ResolveMode::withoutFailFast() );
    992992                PRINT(
    993993                        std::cerr << "known function ops:" << std::endl;
     
    11751175                if ( castExpr->kind == ast::CastExpr::Return ) {
    11761176                        finder.strictMode = true;
    1177                         finder.find( castExpr->arg, ResolvMode::withAdjustment() );
     1177                        finder.find( castExpr->arg, ResolveMode::withAdjustment() );
    11781178
    11791179                        // return casts are eliminated (merely selecting an overload, no actual operation)
    11801180                        candidates = std::move(finder.candidates);
    11811181                }
    1182                 finder.find( castExpr->arg, ResolvMode::withAdjustment() );
     1182                finder.find( castExpr->arg, ResolveMode::withAdjustment() );
    11831183
    11841184                if ( !finder.candidates.empty() ) reason.code = NoMatch;
     
    12511251                CandidateFinder finder( context, tenv );
    12521252                // don't prune here, all alternatives guaranteed to have same type
    1253                 finder.find( castExpr->arg, ResolvMode::withoutPrune() );
     1253                finder.find( castExpr->arg, ResolveMode::withoutPrune() );
    12541254                for ( CandidateRef & r : finder.candidates ) {
    12551255                        addCandidate(
     
    12981298
    12991299                        // don't prune here, since it's guaranteed all alternatives will have the same type
    1300                         finder.find( tech1.get(), ResolvMode::withoutPrune() );
     1300                        finder.find( tech1.get(), ResolveMode::withoutPrune() );
    13011301                        pick_alternatives(finder.candidates, false);
    13021302
     
    13071307                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 })) };
    13081308                // don't prune here, since it's guaranteed all alternatives will have the same type
    1309                 finder.find( fallback.get(), ResolvMode::withoutPrune() );
     1309                finder.find( fallback.get(), ResolveMode::withoutPrune() );
    13101310
    13111311                pick_alternatives(finder.candidates, true);
     
    13161316        void Finder::postvisit( const ast::UntypedMemberExpr * memberExpr ) {
    13171317                CandidateFinder aggFinder( context, tenv );
    1318                 aggFinder.find( memberExpr->aggregate, ResolvMode::withAdjustment() );
     1318                aggFinder.find( memberExpr->aggregate, ResolveMode::withAdjustment() );
    13191319                for ( CandidateRef & agg : aggFinder.candidates ) {
    13201320                        // it's okay for the aggregate expression to have reference type -- cast it to the
     
    14751475        void Finder::postvisit( const ast::LogicalExpr * logicalExpr ) {
    14761476                CandidateFinder finder1( context, tenv );
    1477                 finder1.find( logicalExpr->arg1, ResolvMode::withAdjustment() );
     1477                finder1.find( logicalExpr->arg1, ResolveMode::withAdjustment() );
    14781478                if ( finder1.candidates.empty() ) return;
    14791479
    14801480                CandidateFinder finder2( context, tenv );
    1481                 finder2.find( logicalExpr->arg2, ResolvMode::withAdjustment() );
     1481                finder2.find( logicalExpr->arg2, ResolveMode::withAdjustment() );
    14821482                if ( finder2.candidates.empty() ) return;
    14831483
     
    15051505                // candidates for condition
    15061506                CandidateFinder finder1( context, tenv );
    1507                 finder1.find( conditionalExpr->arg1, ResolvMode::withAdjustment() );
     1507                finder1.find( conditionalExpr->arg1, ResolveMode::withAdjustment() );
    15081508                if ( finder1.candidates.empty() ) return;
    15091509
     
    15111511                CandidateFinder finder2( context, tenv );
    15121512                finder2.allowVoid = true;
    1513                 finder2.find( conditionalExpr->arg2, ResolvMode::withAdjustment() );
     1513                finder2.find( conditionalExpr->arg2, ResolveMode::withAdjustment() );
    15141514                if ( finder2.candidates.empty() ) return;
    15151515
     
    15171517                CandidateFinder finder3( context, tenv );
    15181518                finder3.allowVoid = true;
    1519                 finder3.find( conditionalExpr->arg3, ResolvMode::withAdjustment() );
     1519                finder3.find( conditionalExpr->arg3, ResolveMode::withAdjustment() );
    15201520                if ( finder3.candidates.empty() ) return;
    15211521
     
    15701570
    15711571                CandidateFinder finder2( context, env );
    1572                 finder2.find( commaExpr->arg2, ResolvMode::withAdjustment() );
     1572                finder2.find( commaExpr->arg2, ResolveMode::withAdjustment() );
    15731573
    15741574                for ( const CandidateRef & r2 : finder2.candidates ) {
     
    15841584                CandidateFinder finder( context, tenv );
    15851585                finder.allowVoid = true;
    1586                 finder.find( ctorExpr->callExpr, ResolvMode::withoutPrune() );
     1586                finder.find( ctorExpr->callExpr, ResolveMode::withoutPrune() );
    15871587                for ( CandidateRef & r : finder.candidates ) {
    15881588                        addCandidate( *r, new ast::ConstructorExpr{ ctorExpr->location, r->expr } );
     
    15931593                // resolve low and high, accept candidates where low and high types unify
    15941594                CandidateFinder finder1( context, tenv );
    1595                 finder1.find( rangeExpr->low, ResolvMode::withAdjustment() );
     1595                finder1.find( rangeExpr->low, ResolveMode::withAdjustment() );
    15961596                if ( finder1.candidates.empty() ) return;
    15971597
    15981598                CandidateFinder finder2( context, tenv );
    1599                 finder2.find( rangeExpr->high, ResolvMode::withAdjustment() );
     1599                finder2.find( rangeExpr->high, ResolveMode::withAdjustment() );
    16001600                if ( finder2.candidates.empty() ) return;
    16011601
     
    16731673        void Finder::postvisit( const ast::UniqueExpr * unqExpr ) {
    16741674                CandidateFinder finder( context, tenv );
    1675                 finder.find( unqExpr->expr, ResolvMode::withAdjustment() );
     1675                finder.find( unqExpr->expr, ResolveMode::withAdjustment() );
    16761676                for ( CandidateRef & r : finder.candidates ) {
    16771677                        // ensure that the the id is passed on so that the expressions are "linked"
     
    16991699                        // only open for the duration of resolving the UntypedExpr.
    17001700                        CandidateFinder finder( context, tenv, toType );
    1701                         finder.find( initExpr->expr, ResolvMode::withAdjustment() );
     1701                        finder.find( initExpr->expr, ResolveMode::withAdjustment() );
    17021702
    17031703                        Cost minExprCost = Cost::infinity;
     
    18891889}
    18901890
    1891 void CandidateFinder::find( const ast::Expr * expr, ResolvMode mode ) {
     1891void CandidateFinder::find( const ast::Expr * expr, ResolveMode mode ) {
    18921892        // Find alternatives for expression
    18931893        ast::Pass<Finder> finder{ *this };
     
    20042004        for ( const auto & x : xs ) {
    20052005                out.emplace_back( context, env );
    2006                 out.back().find( x, ResolvMode::withAdjustment() );
     2006                out.back().find( x, ResolveMode::withAdjustment() );
    20072007
    20082008                PRINT(
  • src/ResolvExpr/CandidateFinder.hpp

    r7f2bfb7 r4dc3b8c  
    1717
    1818#include "Candidate.hpp"
    19 #include "ResolvMode.h"
     19#include "ResolveMode.hpp"
    2020#include "AST/Fwd.hpp"
    2121#include "AST/Node.hpp"
     
    4343
    4444        /// Fill candidates with feasible resolutions for `expr`
    45         void find( const ast::Expr * expr, ResolvMode mode = {} );
     45        void find( const ast::Expr * expr, ResolveMode mode = {} );
    4646        bool pruneCandidates( CandidateList & candidates, CandidateList & out, std::vector<std::string> & errors );
    4747
  • src/ResolvExpr/CandidatePrinter.cpp

    r7f2bfb7 r4dc3b8c  
    1616#include "CandidatePrinter.hpp"
    1717
     18#include <iostream>
     19
    1820#include "AST/Expr.hpp"
    1921#include "AST/Pass.hpp"
     
    2325#include "ResolvExpr/CandidateFinder.hpp"
    2426#include "ResolvExpr/Resolver.h"
    25 
    26 #include <iostream>
    2727
    2828namespace ResolvExpr {
     
    3939                ast::TypeEnvironment env;
    4040                CandidateFinder finder( { symtab, transUnit().global }, env );
    41                 finder.find( stmt->expr, ResolvMode::withAdjustment() );
     41                finder.find( stmt->expr, ResolveMode::withAdjustment() );
    4242                int count = 1;
    4343                os << "There are " << finder.candidates.size() << " candidates\n";
  • src/ResolvExpr/ResolveMode.hpp

    r7f2bfb7 r4dc3b8c  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // ResolvMode.h --
     7// ResolveMode.hpp --
    88//
    99// Author           : Aaron B. Moss
     
    1919
    2020/// Flag set for resolution
    21 struct ResolvMode {
     21struct ResolveMode {
    2222        const bool adjust;                       ///< Adjust array and function types to pointer types? [false]
    2323        const bool prune;            ///< Prune alternatives to min-cost per return type? [true]
    2424        const bool failFast;         ///< Fail on no resulting alternatives? [true]
    2525
    26         constexpr ResolvMode(bool a, bool p, bool ff)
     26        constexpr ResolveMode(bool a, bool p, bool ff)
    2727        : adjust(a), prune(p), failFast(ff) {}
    2828
    2929        /// Default settings
    30         constexpr ResolvMode() : adjust(false), prune(true), failFast(true) {}
     30        constexpr ResolveMode() : adjust(false), prune(true), failFast(true) {}
    3131
    3232        /// With adjust flag set; turns array and function types into equivalent pointers
    33         static constexpr ResolvMode withAdjustment() { return { true, true, true }; }
     33        static constexpr ResolveMode withAdjustment() { return { true, true, true }; }
    3434
    3535        /// With adjust flag set but prune unset; pruning ensures there is at least one alternative
    3636        /// per result type
    37         static constexpr ResolvMode withoutPrune() { return { true, false, true }; }
     37        static constexpr ResolveMode withoutPrune() { return { true, false, true }; }
    3838
    3939        /// With adjust and prune flags set but failFast unset; failFast ensures there is at least
    4040        /// one resulting alternative
    41         static constexpr ResolvMode withoutFailFast() { return { true, true, false }; }
     41        static constexpr ResolveMode withoutFailFast() { return { true, true, false }; }
    4242
    4343        /// The same mode, but with satisfyAssns turned on; for top-level calls
    44         ResolvMode atTopLevel() const { return { adjust, true, failFast }; }
     44        ResolveMode atTopLevel() const { return { adjust, true, failFast }; }
    4545};
    4646
  • src/ResolvExpr/Resolver.cc

    r7f2bfb7 r4dc3b8c  
    2525#include "Resolver.h"
    2626#include "ResolveTypeof.h"
    27 #include "ResolvMode.h"                  // for ResolvMode
     27#include "ResolveMode.hpp"               // for ResolveMode
    2828#include "typeops.h"                     // for extractResultType
    2929#include "Unify.h"                       // for unify
     
    123123                CandidateRef findUnfinishedKindExpression(
    124124                        const ast::Expr * untyped, const ResolveContext & context, const std::string & kind,
    125                         std::function<bool(const Candidate &)> pred = anyCandidate, ResolvMode mode = {}
     125                        std::function<bool(const Candidate &)> pred = anyCandidate, ResolveMode mode = {}
    126126                ) {
    127127                        if ( ! untyped ) return nullptr;
     
    263263                ast::ptr< ast::CastExpr > untyped = new ast::CastExpr{ expr };
    264264                CandidateRef choice = findUnfinishedKindExpression(
    265                         untyped, context, "", anyCandidate, ResolvMode::withAdjustment() );
     265                        untyped, context, "", anyCandidate, ResolveMode::withAdjustment() );
    266266
    267267                // a cast expression has either 0 or 1 interpretations (by language rules);
     
    292292                        const ast::Expr * untyped, const ResolveContext & context,
    293293                        std::function<bool(const Candidate &)> pred = anyCandidate,
    294                         const std::string & kind = "", ResolvMode mode = {}
     294                        const std::string & kind = "", ResolveMode mode = {}
    295295                ) {
    296296                        if ( ! untyped ) return {};
     
    860860
    861861                        // Find all candidates for a function in canonical form
    862                         funcFinder.find( clause.target, ResolvMode::withAdjustment() );
     862                        funcFinder.find( clause.target, ResolveMode::withAdjustment() );
    863863
    864864                        if ( funcFinder.candidates.empty() ) {
  • src/ResolvExpr/module.mk

    r7f2bfb7 r4dc3b8c  
    4747      ResolvExpr/ResolveTypeof.cc \
    4848      ResolvExpr/ResolveTypeof.h \
    49       ResolvExpr/ResolvMode.h \
     49      ResolvExpr/ResolveMode.hpp \
    5050      ResolvExpr/SatisfyAssertions.cpp \
    5151      ResolvExpr/SatisfyAssertions.hpp \
  • src/Tuples/TupleAssignment.cc

    r7f2bfb7 r4dc3b8c  
    1313// Update Count     : 10
    1414//
     15
     16#include "Tuples.h"
    1517
    1618#include <algorithm>                       // for transform
     
    224226                                // by the cast type as needed, and transfer the resulting environment.
    225227                                ResolvExpr::CandidateFinder finder( spotter.crntFinder.context, env );
    226                                 finder.find( rhsCand->expr, ResolvExpr::ResolvMode::withAdjustment() );
     228                                finder.find( rhsCand->expr, ResolvExpr::ResolveMode::withAdjustment() );
    227229                                assert( 1 == finder.candidates.size() );
    228230                                env = std::move( finder.candidates.front()->env );
     
    345347
    346348                        try {
    347                                 finder.find( expr, ResolvExpr::ResolvMode::withAdjustment() );
     349                                finder.find( expr, ResolvExpr::ResolveMode::withAdjustment() );
    348350                        } catch (...) {
    349351                                // No match is not failure, just that this tuple assignment is invalid.
  • src/Tuples/TupleExpansion.cpp

    r7f2bfb7 r4dc3b8c  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // TupleExpansionNew.cpp --
     7// TupleExpansion.cpp --
    88//
    99// Author           : Henry Xue
     
    294294}
    295295
     296const 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
     319const 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
    296328} // namespace Tuples
     329
  • src/Tuples/module.mk

    r7f2bfb7 r4dc3b8c  
    1919        Tuples/Explode.h \
    2020        Tuples/TupleAssignment.cc \
    21         Tuples/TupleExpansion.cc \
    22         Tuples/TupleExpansionNew.cpp \
     21        Tuples/TupleExpansion.cpp \
    2322        Tuples/Tuples.cc \
    2423        Tuples/Tuples.h
  • src/Validate/FindSpecialDecls.cpp

    r7f2bfb7 r4dc3b8c  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // FindSpecialDeclsNew.cpp -- Find special declarations used in the compiler.
     7// FindSpecialDecls.cpp -- Find special declarations used in the compiler.
    88//
    99// Author           : Andrew Beach
  • src/Validate/FixReturnTypes.cpp

    r7f2bfb7 r4dc3b8c  
    1919#include "AST/Pass.hpp"
    2020#include "AST/Type.hpp"
    21 #include "CodeGen/CodeGeneratorNew.hpp"
     21#include "CodeGen/CodeGenerator.hpp"
    2222#include "ResolvExpr/Unify.h"
    23 
    24 namespace ast {
    25     class TranslationUnit;
    26 }
    2723
    2824namespace Validate {
  • src/Validate/LinkInstanceTypes.cpp

    r7f2bfb7 r4dc3b8c  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // LinkReferenceToTypes.cpp -- Connect instance types to declarations.
     7// LinkInstanceTypes.cpp -- Connect instance types to declarations.
    88//
    99// Author           : Andrew Beach
     
    1414//
    1515
    16 #include "Validate/LinkReferenceToTypes.hpp"
     16#include "Validate/LinkInstanceTypes.hpp"
    1717
    1818#include "AST/Pass.hpp"
     
    331331} // namespace
    332332
    333 void linkReferenceToTypes( ast::TranslationUnit & translationUnit ) {
     333void linkInstanceTypes( ast::TranslationUnit & translationUnit ) {
    334334        ast::Pass<LinkTypesCore>::run( translationUnit );
    335335}
  • src/Validate/LinkInstanceTypes.hpp

    r7f2bfb7 r4dc3b8c  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // LinkReferenceToTypes.hpp -- Connect instance types to declarations.
     7// LinkInstanceTypes.hpp -- Connect instance types to declarations.
    88//
    99// Author           : Andrew Beach
     
    2525/// adjustments, such as setting the sized flag.
    2626/// Because of the sized flag, it must happen before auto-gen.
    27 void linkReferenceToTypes( ast::TranslationUnit & translationUnit );
     27void linkInstanceTypes( ast::TranslationUnit & translationUnit );
    2828
    2929}
  • src/Validate/module.mk

    r7f2bfb7 r4dc3b8c  
    2727        Validate/EnumAndPointerDecay.cpp \
    2828        Validate/EnumAndPointerDecay.hpp \
    29         Validate/FindSpecialDeclsNew.cpp \
     29        Validate/FindSpecialDecls.cpp \
    3030        Validate/FixQualifiedTypes.cpp \
    3131        Validate/FixQualifiedTypes.hpp \
     
    4444        Validate/LabelAddressFixer.cpp \
    4545        Validate/LabelAddressFixer.hpp \
    46         Validate/LinkReferenceToTypes.cpp \
    47         Validate/LinkReferenceToTypes.hpp \
     46        Validate/LinkInstanceTypes.cpp \
     47        Validate/LinkInstanceTypes.hpp \
    4848        Validate/NoIdSymbolTable.hpp \
    4949        Validate/ReplaceTypedef.cpp \
  • src/main.cc

    r7f2bfb7 r4dc3b8c  
    7878#include "Validate/InitializerLength.hpp"   // for setLengthFromInitializer
    7979#include "Validate/LabelAddressFixer.hpp"   // for fixLabelAddresses
    80 #include "Validate/LinkReferenceToTypes.hpp" // for linkReferenceToTypes
     80#include "Validate/LinkInstanceTypes.hpp"   // for linkInstanceTypes
    8181#include "Validate/ReplaceTypedef.hpp"      // for replaceTypedef
    8282#include "Validate/ReturnCheck.hpp"         // for checkReturnStatements
    8383#include "Validate/VerifyCtorDtorAssign.hpp" // for verifyCtorDtorAssign
    8484#include "Virtual/ExpandCasts.h"            // for expandCasts
    85 #include "Virtual/VirtualDtor.hpp"           // for implementVirtDtors
     85#include "Virtual/VirtualDtor.hpp"          // for implementVirtDtors
    8686
    8787using namespace std;
     
    318318                PASS( "Enum and Pointer Decay", Validate::decayEnumsAndPointers, transUnit );
    319319
    320                 PASS( "Link Reference To Types", Validate::linkReferenceToTypes, transUnit );
     320                PASS( "Link Instance Types", Validate::linkInstanceTypes, transUnit );
    321321
    322322                PASS( "Forall Pointer Decay", Validate::decayForallPointers, transUnit );
Note: See TracChangeset for help on using the changeset viewer.