Changeset 2cb8bf71 for src


Ignore:
Timestamp:
May 30, 2023, 5:35:57 PM (3 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ast-experimental, master, stuck-waitfor-destruct
Children:
dd3baf4
Parents:
44198fb9 (diff), 8913de4 (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:
7 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Pass.impl.hpp

    r44198fb9 r2cb8bf71  
    4646
    4747#ifdef PEDANTIC_PASS_ASSERT
    48 #define __pedantic_pass_assert(...) assert (__VA_ARGS__)
     48#define __pedantic_pass_assert(...) assert(__VA_ARGS__)
    4949#define __pedantic_pass_assertf(...) assertf(__VA_ARGS__)
    5050#else
  • src/AST/Pass.proto.hpp

    r44198fb9 r2cb8bf71  
    2727
    2828#ifdef PEDANTIC_PASS_ASSERT
    29 #define __pedantic_pass_assert(...) assert (__VA_ARGS__)
     29#define __pedantic_pass_assert(...) assert(__VA_ARGS__)
    3030#define __pedantic_pass_assertf(...) assertf(__VA_ARGS__)
    3131#else
  • src/Concurrency/Waituntil.cpp

    r44198fb9 r2cb8bf71  
    940940        }
    941941
    942     // C_TODO: will remove this commented code later. Currently it isn't needed but may switch to a modified version of this later if it has better performance
    943     // std::vector<ptr<CaseClause>> switchCases;
    944 
    945     // int idx = 0;
    946     // for ( const auto & clause: stmt->clauses ) {
    947     //     const CodeLocation & cLoc = clause->location;
    948     //     switchCases.push_back(
    949     //         new CaseClause( cLoc,
    950     //             new CastExpr( cLoc,
    951     //                 new AddressExpr( cLoc, new NameExpr( cLoc, data.at(idx)->targetName ) ),
    952     //                 new BasicType( BasicType::Kind::LongUnsignedInt ), GeneratedFlag::ExplicitCast
    953     //             ),
    954     //             {
    955     //                 new CompoundStmt( cLoc,
    956     //                     {
    957     //                         ast::deepCopy( clause->stmt ),
    958     //                         new BranchStmt( cLoc, BranchStmt::Kind::Break, Label( cLoc ) )
    959     //                     }
    960     //                 )
    961     //             }
    962     //         )
    963     //     );
    964     //     idx++;
    965     // }
    966 
    967942    return new CompoundStmt( loc,
    968943        {
    969944            new ExprStmt( loc, new UntypedExpr( loc, new NameExpr( loc, "park" ) ) ),
    970945            outerIf
    971             // new SwitchStmt( loc,
    972             //     new NameExpr( loc, statusName ),
    973             //     std::move( switchCases )
    974             // )
    975946        }
    976947    );
     
    1015986    const CodeLocation & cLoc = stmt->clauses.at(idx)->location;
    1016987
     988    Expr * baseCond = genSelectTraitCall( stmt->clauses.at(idx), data.at(idx), "register_select" );
    1017989    Expr * ifCond;
    1018990
     
    1025997            ),
    1026998            new CastExpr( cLoc,
    1027                 genSelectTraitCall( stmt->clauses.at(idx), data.at(idx), "register_select" ),
     999                baseCond,
    10281000                new BasicType( BasicType::Kind::Bool ), GeneratedFlag::ExplicitCast
    10291001            ),
    10301002            LogicalFlag::AndExpr
    10311003        );
    1032     } else ifCond = genSelectTraitCall( stmt->clauses.at(idx), data.at(idx), "register_select" );
     1004    } else ifCond = baseCond;
    10331005
    10341006    return new CompoundStmt( cLoc,
  • src/SymTab/Autogen.h

    r44198fb9 r2cb8bf71  
    2020#include <string>                 // for string
    2121
    22 #include "AST/Decl.hpp"
    23 #include "AST/Expr.hpp"
    24 #include "AST/Init.hpp"
    25 #include "AST/Node.hpp"
    26 #include "AST/Stmt.hpp"
    27 #include "AST/Type.hpp"
    2822#include "CodeGen/OperatorTable.h"
    2923#include "Common/UniqueName.h"    // for UniqueName
     
    5751        /// maybePolymorphic is true if the resulting FunctionType is allowed to be polymorphic
    5852        FunctionType * genCopyType( Type * paramType, bool maybePolymorphic = true );
    59 
    60         /// Enum for loop direction
    61         enum LoopDirection { LoopBackward, LoopForward };
    6253
    6354        /// inserts into out a generated call expression to function fname with arguments dstParam and srcParam. Intended to be used with generated ?=?, ?{}, and ^?{} calls.
  • src/SymTab/GenImplicitCall.cpp

    r44198fb9 r2cb8bf71  
    1616#include "GenImplicitCall.hpp"
    1717
     18#include "AST/Decl.hpp"                  // for ObjectDecl
     19#include "AST/Expr.hpp"                  // for ConstantExpr, UntypedExpr,...
     20#include "AST/Init.hpp"                  // for SingleInit
    1821#include "AST/Inspect.hpp"               // for isUnnamedBitfield
     22#include "AST/Stmt.hpp"                  // for ExprStmt
     23#include "AST/Type.hpp"                  // for ArrayType, BasicType, ...
    1924#include "CodeGen/OperatorTable.h"       // for isCtorDtor
    2025#include "Common/UniqueName.h"           // for UniqueName
    2126
    2227namespace SymTab {
     28
     29namespace {
    2330
    2431template< typename OutIter >
     
    173180}
    174181
     182} // namespace
     183
    175184ast::ptr< ast::Stmt > genImplicitCall(
    176185        InitTweak::InitExpander_new & srcParam, const ast::Expr * dstParam,
  • src/SymTab/GenImplicitCall.hpp

    r44198fb9 r2cb8bf71  
    1717
    1818#include "InitTweak/InitTweak.h"  // for InitExpander
    19 #include "SymTab/Autogen.h"       // for LoopDirection
    2019
    2120namespace SymTab {
    2221
     22/// Enum for loop direction
     23enum LoopDirection { LoopBackward, LoopForward };
     24
     25/// Returns a generated call expression to function fname with srcParam and
     26/// dstParam. Intended to be used with generated ?=?, ?{}, and ^?{} calls.
    2327ast::ptr<ast::Stmt> genImplicitCall(
    2428        InitTweak::InitExpander_new & srcParam, const ast::Expr * dstParam,
     
    3438// compile-command: "make install" //
    3539// End: //
    36 
  • src/Validate/Autogen.cpp

    r44198fb9 r2cb8bf71  
    4444#include "CompilationState.h"
    4545
    46 // TODO: The other new ast function should be moved over to this file.
    47 #include "SymTab/Autogen.h"
    48 
    4946namespace Validate {
    5047
     
    9693
    9794        const CodeLocation& getLocation() const { return getDecl()->location; }
    98         ast::FunctionDecl * genProto( const std::string& name,
     95        ast::FunctionDecl * genProto( std::string&& name,
    9996                std::vector<ast::ptr<ast::DeclWithType>>&& params,
    10097                std::vector<ast::ptr<ast::DeclWithType>>&& returns ) const;
     
    337334}
    338335
     336void replaceAll( std::vector<ast::ptr<ast::DeclWithType>> & dwts,
     337                const ast::DeclReplacer::TypeMap & map ) {
     338        for ( auto & dwt : dwts ) {
     339                dwt = strict_dynamic_cast<const ast::DeclWithType *>(
     340                                ast::DeclReplacer::replace( dwt, map ) );
     341        }
     342}
     343
    339344/// Generates a basic prototype function declaration.
    340 ast::FunctionDecl * FuncGenerator::genProto( const std::string& name,
     345ast::FunctionDecl * FuncGenerator::genProto( std::string&& name,
    341346                std::vector<ast::ptr<ast::DeclWithType>>&& params,
    342347                std::vector<ast::ptr<ast::DeclWithType>>&& returns ) const {
     
    344349        // Handle generic prameters and assertions, if any.
    345350        auto const & old_type_params = getGenericParams( type );
     351        ast::DeclReplacer::TypeMap oldToNew;
    346352        std::vector<ast::ptr<ast::TypeDecl>> type_params;
    347353        std::vector<ast::ptr<ast::DeclWithType>> assertions;
    348354        for ( auto & old_param : old_type_params ) {
    349355                ast::TypeDecl * decl = ast::deepCopy( old_param );
    350                 for ( auto assertion : decl->assertions ) {
    351                         assertions.push_back( assertion );
    352                 }
    353                 decl->assertions.clear();
     356                decl->init = nullptr;
     357                splice( assertions, decl->assertions );
     358                oldToNew.emplace( std::make_pair( old_param, decl ) );
    354359                type_params.push_back( decl );
    355360        }
    356         // TODO: The values in params and returns still may point at the old
    357         // generic params, that does not appear to be an issue but perhaps it
    358         // should be addressed.
     361        replaceAll( params, oldToNew );
     362        replaceAll( returns, oldToNew );
     363        replaceAll( assertions, oldToNew );
    359364
    360365        ast::FunctionDecl * decl = new ast::FunctionDecl(
    361366                // Auto-generated routines use the type declaration's location.
    362367                getLocation(),
    363                 name,
     368                std::move( name ),
    364369                std::move( type_params ),
    365370                std::move( assertions ),
Note: See TracChangeset for help on using the changeset viewer.