Changeset e14d169 for src


Ignore:
Timestamp:
Oct 16, 2023, 1:56:40 PM (14 months ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
master
Children:
4d2d7e27, 52a5262e
Parents:
6bd9f9e
Message:

Remove some cruft from the box pass. Some pieces left over from earlier versions that are no longer needed and some rejected notes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/GenPoly/BoxNew.cpp

    r6bd9f9e re14d169  
    376376        ast::Expr const * postvisit( ast::AddressExpr const * expr );
    377377        ast::ReturnStmt const * previsit( ast::ReturnStmt const * stmt );
    378         void previsit( ast::PointerType const * type );
    379         void previsit( ast::FunctionType const * type );
    380378
    381379        void beginScope();
     
    553551
    554552ast::FunctionDecl const * CallAdapter::previsit( ast::FunctionDecl const * decl ) {
     553        // Prevent type declaration information from leaking out.
     554        GuardScope( scopeTypeVars );
     555
    555556        if ( nullptr == decl->stmts ) {
    556                 // This may keep TypeDecls we don't ever want from sneaking in.
    557                 // Not visiting child nodes might just be faster.
    558                 GuardScope( scopeTypeVars );
    559557                return decl;
    560558        }
    561559
    562         GuardScope( scopeTypeVars );
    563560        GuardValue( retval );
    564561
     
    687684
    688685        assert( typeSubs );
    689         ast::Type const * concRetType = replaceWithConcrete( dynRetType, *typeSubs );
    690         // Used to use dynRetType instead of concRetType; this changed so that
    691         // the correct type parameters are passed for return types (it should be
    692         // the concrete type's parameters, not the formal type's).
    693686        ast::vector<ast::Expr>::iterator argIt =
    694687                passTypeVars( mutExpr, function );
     
    768761        }
    769762        return stmt;
    770 }
    771 
    772 void CallAdapter::previsit( ast::PointerType const * type ) {
    773         GuardScope( scopeTypeVars );
    774         makeTypeVarMap( type, scopeTypeVars );
    775 }
    776 
    777 void CallAdapter::previsit( ast::FunctionType const * type ) {
    778         GuardScope( scopeTypeVars );
    779         makeTypeVarMap( type, scopeTypeVars );
    780763}
    781764
     
    15951578        PolyGenericCalculator();
    15961579
    1597         void previsit( ast::ObjectDecl const * decl );
    15981580        void previsit( ast::FunctionDecl const * decl );
    15991581        void previsit( ast::TypedefDecl const * decl );
     
    16021584        ast::StructDecl const * previsit( ast::StructDecl const * decl );
    16031585        ast::UnionDecl const * previsit( ast::UnionDecl const * decl );
    1604         void previsit( ast::PointerType const * type );
    1605         void previsit( ast::FunctionType const * type );
    16061586        ast::DeclStmt const * previsit( ast::DeclStmt const * stmt );
    16071587        ast::Expr const * postvisit( ast::MemberExpr const * expr );
     
    16391619        /// adding the type variables from the provided type.
    16401620        void beginTypeScope( ast::Type const * );
    1641         /// Enters a new scope for known layouts and offsets, and queues exit calls.
    1642         void beginGenericScope();
    16431621
    16441622        /// Set of generic type layouts known in the current scope,
     
    16521630        /// If the argument of an AddressExpr is MemberExpr, it is stored here.
    16531631        ast::MemberExpr const * addrMember = nullptr;
    1654         /// Used to avoid recursing too deep in type declarations.
    1655         bool expect_func_type = false;
    16561632};
    16571633
     
    16751651}
    16761652
    1677 void PolyGenericCalculator::previsit( ast::ObjectDecl const * decl ) {
    1678         beginTypeScope( decl->type );
    1679 }
    1680 
    16811653void PolyGenericCalculator::previsit( ast::FunctionDecl const * decl ) {
    1682         beginGenericScope();
     1654        GuardScope( *this );
    16831655        beginTypeScope( decl->type );
    16841656}
     
    17421714}
    17431715
    1744 void PolyGenericCalculator::previsit( ast::PointerType const * type ) {
    1745         beginTypeScope( type );
    1746 }
    1747 
    1748 void PolyGenericCalculator::previsit( ast::FunctionType const * type ) {
    1749         beginTypeScope( type );
    1750 
    1751         GuardValue( expect_func_type );
    1752         GuardScope( *this );
    1753 
    1754         // The other functions type we will see in this scope are probably
    1755         // function parameters they don't help us with the layout and offsets so
    1756         // don't mark them as known in this scope.
    1757         expect_func_type = false;
    1758 }
    1759 
    1760 //void PolyGenericCalculator::previsit( ast::DeclStmt const * stmt ) {
    17611716ast::DeclStmt const * PolyGenericCalculator::previsit( ast::DeclStmt const * stmt ) {
    17621717        ast::ObjectDecl const * decl = stmt->decl.as<ast::ObjectDecl>();
     
    22482203}
    22492204
    2250 void PolyGenericCalculator::beginGenericScope() {
    2251         GuardScope( *this );
    2252         // We expect the first function type see to be the type relating to this
    2253         // scope but any further type is probably some unrelated function pointer
    2254         // keep track of whrich is the first.
    2255         GuardValue( expect_func_type ) = true;
    2256 }
    2257 
    22582205// --------------------------------------------------------------------------
    2259 /// No common theme found.
     2206/// Removes unneeded or incorrect type information.
    22602207/// * Replaces initialization of polymorphic values with alloca.
    22612208/// * Replaces declaration of dtype/ftype with appropriate void expression.
Note: See TracChangeset for help on using the changeset viewer.